docs: def guess_format(url):
      """Try to guess  the format of a resource, possibly with a HEAD request"""
      import requests
      from requests.exceptions import InvalidSchema
      from rowgenerators import parse_url_to_dict
  
      parts = parse_url_to_dict(url)
  
      # Guess_type fails for root urls like 'http://civicknowledge.com'
      if parts.get('path'):
          type, encoding = mimetypes.guess_type(url)
      elif parts['scheme'] in ('http', 'https'):
          type, encoding = 'text/html', None  # Assume it is a root url
      else:
          type, encoding = None, None
  
      if type is None:
          try:
              r = requests.head(url, allow_redirects=False)
              type = r.headers['Content-Type']
  
              if ';' in type:
                  type, encoding = [e.strip() for e in type.split(';')]
  
          except InvalidSchema:
              pass  # It's probably FTP
  
      return type, mime_map.get(type)