class_docstr: MIME-types datastore.
  
  This datastore can handle information from mime.types-style files
  and supports basic determination of MIME type from a filename or
  URL, and can guess a reasonable extension given a MIME type.
docstr: Guess the type of a file which is either a URL or a path-like object.
  
  Return value is a tuple (type, encoding) where type is None if
  the type can't be guessed (no or unknown suffix) or a string
  of the form type/subtype, usable for a MIME Content-type
  header; and encoding is None for no encoding or the name of
  the program used to encode (e.g. compress or gzip).  The
  mappings are table driven.  Encoding suffixes are case
  sensitive; type suffixes are first tried case sensitive, then
  case insensitive.
  
  The suffixes .tgz, .taz and .tz (case sensitive!) are all
  mapped to '.tar.gz'.  (This is table-driven too, using the
  dictionary suffix_map.)
  
  Optional `strict' argument when False adds a bunch of commonly found,
  but non-standard types.
docstr_tok: ["Guess","the","type","of","a","file","which","is","either","a","URL","or","a","path-like","object",".","Return","value","is","a","tuple","(","type",",","encoding",")","where","type","is","None","if","the","type","ca","n't","be","guessed","(","no","or","unknown","suffix",")","or","a","string","of","the","form","type\/subtype",",","usable","for","a","MIME","Content-type","header",";","and","encoding","is","None","for","no","encoding","or","the","name","of","the","program","used","to","encode","(","e.g",".","compress","or","gzip",")",".","The","mappings","are","table","driven",".","Encoding","suffixes","are","case","sensitive",";","type","suffixes","are","first","tried","case","sensitive",",","then","case","insensitive",".","The","suffixes",".tgz",",",".taz","and",".tz","(","case","sensitive","!",")","are","all","mapped","to","'.tar.gz","'",".","(","This","is","table-driven","too",",","using","the","dictionary","suffix_map",".",")","Optional","`","strict","'","argument","when","False","adds","a","bunch","of","commonly","found",",","but","non-standard","types","."]
code: def guess_type(self, url, strict=True):
      """Guess the type of a file which is either a URL or a path-like object.
  
      Return value is a tuple (type, encoding) where type is None if
      the type can't be guessed (no or unknown suffix) or a string
      of the form type/subtype, usable for a MIME Content-type
      header; and encoding is None for no encoding or the name of
      the program used to encode (e.g. compress or gzip).  The
      mappings are table driven.  Encoding suffixes are case
      sensitive; type suffixes are first tried case sensitive, then
      case insensitive.
  
      The suffixes .tgz, .taz and .tz (case sensitive!) are all
      mapped to '.tar.gz'.  (This is table-driven too, using the
      dictionary suffix_map.)
  
      Optional `strict' argument when False adds a bunch of commonly found,
      but non-standard types.
      """
      url = os.fspath(url)
      scheme, url = urllib.parse._splittype(url)
      if scheme == "data":
          # syntax of data URLs:
          # dataurl   := "data:" [ mediatype ] [ ";base64" ] "," data
          # mediatype := [ type "/" subtype ] *( ";" parameter )
          # data      := *urlchar
          # parameter := attribute "=" value
          # type/subtype defaults to "text/plain"
          comma = url.find(",")
          if comma < 0:
              # bad data URL
              return None, None
          semi = url.find(";", 0, comma)
          if semi >= 0:
              type = url[:semi]
          else:
              type = url[:comma]
          if "=" in type or "/" not in type:
              type = "text/plain"
          return type, None  # never compressed, so encoding is None
      base, ext = posixpath.splitext(url)
      while (ext_lower := ext.lower()) in self.suffix_map:
          base, ext = posixpath.splitext(
              base + self.suffix_map[ext_lower]
          )
      # encodings_map is case sensitive
      if ext in self.encodings_map:
          encoding = self.encodings_map[ext]
          base, ext = posixpath.splitext(base)
      else:
          encoding = None
      ext = ext.lower()
      types_map = self.types_map[True]
      if ext in types_map:
          return types_map[ext], encoding
      elif strict:
          return None, encoding
      types_map = self.types_map[False]
      if ext in types_map:
          return types_map[ext], encoding
      else:
          return None, encoding
  
imports: import os
  import sys
  import posixpath
  import urllib.parse
label_desc: Use image node_id 3 for calling the MimeTypes obj's underlying member method code with example usage: obj.guess_type(url, strict) and returns: type,  None, types_map,  encoding, types_map,  encoding, None,  encoding, None,  None, None,  encoding