'Returns a mimetype based on an extension'

def get_mimetype_by_extension(self, ext, default='application/octet-stream'):

    try:
        mimetype = self.mimetypes_by_extension[ext]
    except KeyError:
        mimetype = default
        self.log.warning(('unknown    mimetype    in    data    factory    %s' % str(ext)))
    return mimetype
