code: def guess_mime_mimedb (filename):
      
      mime, encoding = None, None
      if mimedb is not None:
          mime, encoding = mimedb.guess_type(filename, strict=False)
      if mime not in ArchiveMimetypes and encoding in ArchiveCompressions:
          # Files like 't.txt.gz' are recognized with encoding as format, and
          # an unsupported mime-type like 'text/plain'. Fix this.
          mime = Encoding2Mime[encoding]
          encoding = None
      return mime, encoding
docs: Guess MIME type from given filename.
      @return: tuple (mime, encoding)