import mimetypes


def get_mimetype(url):
    """
    Guess based on the file extension.

    Args:
        url (text): Web url that was linked to by a reddit submission.

    Returns:
        modified_url (text): The url (or filename) that will be used when
            constructing the command to run.
        content_type (text): The mime-type that will be used when
            constructing the command to run. If the mime-type is unknown,
            return None and the program will fallback to using the web
            browser.
    """
    filename = url.split('?')[0]
    filename = filename.split('#')[0]
    content_type, encoding = mimetypes.guess_type(filename)
    return url, content_type