code: def _build_regexes():
      
      # Define a regex that matches ASCII text.
      encoding_regexes = {'ascii': re.compile('^[\x00-\x7f]*$')}
  
      for encoding in CHARMAP_ENCODINGS:
          # Make a sequence of characters that bytes \x80 to \xFF decode to
          # in each encoding, as well as byte \x1A, which is used to represent
          # the replacement character � in the sloppy-* encodings.
          byte_range = bytes(list(range(0x80, 0x100)) + [0x1a])
          charlist = byte_range.decode(encoding)
  
          # The rest of the ASCII bytes -- bytes \x00 to \x19 and \x1B
          # to \x7F -- will decode as those ASCII characters in any encoding we
          # support, so we can just include them as ranges. This also lets us
          # not worry about escaping regex special characters, because all of
          # them are in the \x1B to \x7F range.
          regex = '^[\x00-\x19\x1b-\x7f{0}]*$'.format(charlist)
          encoding_regexes[encoding] = re.compile(regex)
      return encoding_regexes
docs: ENCODING_REGEXES contain reasonably fast ways to detect if we
      could represent a given string in a given encoding. The simplest one is
      the 'ascii' detector, which of course just determines if all characters
      are between U+0000 and U+007F.