def METHOD_NAME(request):
    user_name = request.path_info.rsplit("/", 1)[-1]
    User = get_user_model()
    if user_name is None or not user_name or user_name == "users":
        METHOD_NAME = [user for user in User.objects.all()]
    else:
        METHOD_NAME = [user for user in User.objects.filter(username=user_name)]
        if not METHOD_NAME:
            # Try using the user email
            METHOD_NAME = [user for user in User.objects.filter(email=user_name)]
    json_object = []
    for user in METHOD_NAME:
        groups = [group.name for group in user.groups.all()]
        if user.is_superuser:
            groups.append("admin")
        json_object.append({"username": user.username, "groups": groups})
    return HttpResponse(json.dumps({"users": json_object}), content_type="application/json")