import mimetypes


def guess_extension(content_type):
    """
    Guess extension

    Parameters
    -----------
    content_type: str
        MIME type

    Returns
    --------
    str
        Extension or None if not found
    """
    if content_type == "text/plain":
        ext = ".txt"
    else:
        ext = mimetypes.guess_extension(content_type)

    if ext == ".htm":
        ext = ".html"
    elif ext == ".jpe":
        ext = ".jpg"

    return ext