def decoder(jsonobj): if 'source' in jsonobj: return TrackedLayer(jsonobj['source'], jsonobj['repoUrl']) else: return jsonobj