<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def parse_permission_set(input):
 """Lookup a permission set name in the defined permissions. Requires a Flask app context. """


    # Priority goes to the user's parsers.
    if isinstance(input, basestring):
        for func in current_acl_manager.permission_set_parsers:
            res = func(input)
            if res is not None:
                input = res
                break

    if isinstance(input, basestring):
        try:
            return current_acl_manager.permission_sets[input]
        except KeyError:
            raise ValueError('unknown permission set %r' % input)

    return input