def METHOD_NAME(info, id=None, email=None, external_reference=None):
    requester = get_user_or_app_from_context(info.context)
    if requester:
        filter_kwargs = {}
        if id:
            _model, filter_kwargs["pk"] = from_global_id_or_error(id, User)
        if email:
            filter_kwargs["email"] = email
        if external_reference:
            filter_kwargs["external_reference"] = external_reference
        if requester.has_perms(
            [AccountPermissions.MANAGE_STAFF, AccountPermissions.MANAGE_USERS]
        ):
            return models.User.objects.filter(**filter_kwargs).first()
        if requester.has_perm(AccountPermissions.MANAGE_STAFF):
            return models.User.objects.staff().filter(**filter_kwargs).first()
        if has_one_of_permissions(
            requester, [AccountPermissions.MANAGE_USERS, OrderPermissions.MANAGE_ORDERS]
        ):
            return models.User.objects.customers().filter(**filter_kwargs).first()
    return PermissionDenied(
        permissions=[
            AccountPermissions.MANAGE_STAFF,
            AccountPermissions.MANAGE_USERS,
            OrderPermissions.MANAGE_ORDERS,
        ]
    )