human
Complete this python program:
def is_field_shared_factory(field_name):
assistant
#Here is the Python program you requested.

    """Generates a permission class that grants access if a particular profile field is
    shared with the requesting user.
    """
    class IsFieldShared(permissions.BasePermission, ):
        '\n                                Grants    access    if    a    particular    profile    field    is    shared    with    the    requesting    user.\n                                '
        def has_permission(self, request, view):
            url_username = request.parser_context.get('kwargs', {}).get('username', '')
            if (request.user.username.lower() == url_username.lower()):
                return True
            if request.user.is_staff:
                return True
            user = get_object_or_404(User, username__iexact=url_username)
            if (field_name in visible_fields(user.profile, user)):
                return True
            raise Http404()
    return IsFieldShared