import mimetypes


def img_mime_type(img):
    """Returns image MIME type or ``None``.

    Parameters
    ----------
    img: `PIL.Image`
        PIL Image object.

    Returns
    -------
    mime_type : `str`
        MIME string like "image/jpg" or ``None``.
    """
    if img.format:
        ext = "." + img.format
        return mimetypes.types_map.get(ext.lower())
    return None