'Guess the type of a file.
Argument is a PATH (a filename).
Return value is a string of the form type/subtype,
usable for a MIME Content-type header.
The default implementation looks the file\'s extension
up in the table self.extensions_map, using application/octet-stream
as a default; however it would be permissible (if
slow) to look inside the data to make a better guess.'

def _guess_type(self, path):

    (base, ext) = posixpath.splitext(path)
    if (ext in self.extensions_map):
        return self.extensions_map[ext]
    ext = ext.lower()
    if (ext in self.extensions_map):
        return self.extensions_map[ext]
    else:
        return self.extensions_map['']
