def METHOD_NAME(o):
    version = o["v"]
    if version not in (1, 2):
        raise ValueError(f"Unexpected version {version}")
    references = o.get("references", {})
    data = _js2py(o["data"], references, version)
    return data