code: def guess_mimetype_read(read):
      
      mime = None
      try:
          data = read()[:70]
      except Exception:
          pass
      else:
          for cmime, ro in PARSE_CONTENTS.items():
              if ro.search(data):
                  mime = cmime
                  break
      return mime
docs: Try to read some content and do a poor man's file(1).