def resolve_refs(spec, val):
    if isinstance(val, dict):
        new_dict = {}
        for key, subval in val.items():
            if key == '$ref':
                # assume $ref is the only key in the dict
                return resolve_ref(spec, subval)
            else:
                new_dict[key] = resolve_refs(spec, subval)
        return new_dict

    if isinstance(val, list):
        for index, subval in enumerate(val):
            val[index] = resolve_refs(spec, subval)

    return val
dataset/ETHPy150Open striglia/pyramid_swagger/pyramid_swagger/api.py/resolve_refs/original