code: def read_bom(data):
      
      # common case is no BOM, so this is fast
      if data and data[0] in _FIRST_CHARS:
          for bom, encoding in _BOM_TABLE:
              if data.startswith(bom):
                  return encoding, bom
      return None, None
docs: Read the byte order mark in the text, if present, and
      return the encoding represented by the BOM and the BOM.
  
      If no BOM can be detected, (None, None) is returned.