def _norm_encoding(encoding):
 try:
  return codecs.lookup(encoding).name
 except LookupError:
  return encoding

def _norm_encoding ( encoding ) : try : return codecs . lookup ( encoding ) . name except LookupError : return encoding
normalize the encoding name -- where "normalized" is what pythons codecs module calls it .