def METHOD_NAME(obj, seen):
    seen.add(obj['key'])
    while obj['type']['key'] == '/type/redirect':
        assert obj['location'] != obj['key']
        obj = web.ctx.site.get(obj['location'])
        seen.add(obj['key'])
    return obj