<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_attr_desc(instance, attribute, action):
 """ Fetch the appropriate descriptor for the attribute. :param instance: Model instance :param attribute: Name of the attribute :param action: AttributeAction """

    descs = instance.__jsonapi_attribute_descriptors__.get(attribute, {})
    if action == AttributeActions.GET:
        check_permission(instance, attribute, Permissions.VIEW)
        return descs.get(action, lambda x: getattr(x, attribute))
    check_permission(instance, attribute, Permissions.EDIT)
    return descs.get(action, lambda x, v: setattr(x, attribute, v))