def make_get_perms_object(perms_objs):
def retfn(obj, action):<EOL><INDENT>if action in perms_objs:<EOL><INDENT>if perms_objs[action] is None:<EOL><INDENT>return None<EOL><DEDENT>else:<EOL><INDENT>return get_perms_object(getattr(obj, perms_objs[action]),<EOL>action)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>return get_perms_object(obj, action)<EOL><DEDENT><DEDENT>return retfn<EOL>
Make a function to delegate permission object rendering to some
    other (foreign key) field of an object.