def encoding(argument):
 try:
  codecs.lookup(argument)
 except LookupError:
  raise ValueError(('unknown encoding: "%s"' % argument))
 return argument

def encoding ( argument ) : try : codecs . lookup ( argument ) except LookupError : raise ValueError ( ( 'unknown encoding: "%s"' % argument ) ) return argument
verfies the encoding argument by lookup .