def METHOD_NAME(uploaded_file):
    image = Image.open(uploaded_file)
    min_size = max(settings.MISAGO_AVATARS_SIZES)
    if min(image.size) < min_size:
        message = pgettext(
            "avatar upload dimensions validator",
            "Uploaded image should be at least %(size)s pixels tall and wide.",
        )
        raise ValidationError(message % {"size": min_size})
    if image.size[0] * image.size[1] > 2000 * 3000:
        message = pgettext(
            "avatar upload dimensions validator",
            "Uploaded image is too big.",
        )
        raise ValidationError(message)
    image_ratio = float(min(image.size)) / float(max(image.size))
    if image_ratio < 0.25:
        message = pgettext(
            "avatar upload dimensions validator",
            "Uploaded image ratio cannot be greater than 16:9.",
        )
        raise ValidationError(message)
    return image