docs: def normalize(symbol_string, strict=False):
      """Normalize an encoded symbol string.
  
      Normalization provides error correction and prepares the
      string for decoding. These transformations are applied:
  
         1. Hyphens are removed
         2. 'I', 'i', 'L' or 'l' are converted to '1'
         3. 'O' or 'o' are converted to '0'
         4. All characters are converted to uppercase
  
      A TypeError is raised if an invalid string type is provided.
  
      A ValueError is raised if the normalized string contains
      invalid characters.
  
      If the strict parameter is set to True, a ValueError is raised
      if any of the above transformations are applied.
  
      The normalized string is returned.
      """
      if isinstance(symbol_string, string_types):
          if not PY3:
              try:
                  symbol_string = symbol_string.encode('ascii')
              except UnicodeEncodeError:
                  raise ValueError("string should only contain ASCII characters")
      else:
          raise TypeError("string is of invalid type %s" %
                          symbol_string.__class__.__name__)
  
      norm_string = symbol_string.replace('-', '').translate(normalize_symbols).upper()
  
      if not valid_symbols.match(norm_string):
          raise ValueError("string '%s' contains invalid characters" % norm_string)
  
      if strict and norm_string != symbol_string:
          raise ValueError("string '%s' requires normalization" % symbol_string)
  
      return norm_string