def METHOD_NAME(request, user):
    options = {
        "avatars": user.avatars,
        "generated": True,
        "gravatar": False,
        "crop_src": False,
        "crop_tmp": False,
        "upload": False,
        "galleries": False,
    }
    # Allow existing galleries
    if avatars.gallery.galleries_exist():
        options["galleries"] = []
        for gallery in avatars.gallery.get_available_galleries():
            gallery_images = []
            for image in gallery["images"]:
                gallery_images.append({"id": image.id, "url": image.url})
            options["galleries"].append(
                {"name": gallery["name"], "images": gallery_images}
            )
    # Can't have custom avatar?
    if not request.settings.allow_custom_avatars:
        return options
    # Allow Gravatar download
    options["gravatar"] = True
    # Allow crop if we have uploaded temporary avatar
    if avatars.uploaded.has_source_avatar(user):
        try:
            options["crop_src"] = {
                "url": user.avatar_src.url,
                "crop": json.loads(user.avatar_crop),
                "size": max(settings.MISAGO_AVATARS_SIZES),
            }
        except (TypeError, ValueError):
            pass
    # Allow crop of uploaded avatar
    if avatars.uploaded.has_temporary_avatar(user):
        options["crop_tmp"] = {
            "url": user.avatar_tmp.url,
            "size": max(settings.MISAGO_AVATARS_SIZES),
        }
    # Allow upload conditions
    options["upload"] = {
        "limit": request.settings.avatar_upload_limit * 1024,
        "allowed_extensions": avatars.uploaded.ALLOWED_EXTENSIONS,
        "allowed_mime_types": avatars.uploaded.ALLOWED_MIME_TYPES,
    }
    return options