Module
mimetypes

Guess the MIME type of a file.

This module defines two useful functions:

guess_type(url, strict=1)
guess the MIME type and encoding of a URL.
guess_extension(type, strict=1)
guess the extension for a given MIME type.

It also contains the following, for tuning the behavior:

Data:

knownfiles
list of files to parse inited -- flag set when init() has been called suffix_map -- dictionary mapping suffixes to suffixes encodings_map -- dictionary mapping suffixes to encodings types_map -- dictionary mapping suffixes to types

Functions:

init([files])
parse a list of files, default knownfiles read_mime_types(file) -- parse one file, return a dictionary or None