def validate_encoding(encoding):
 try:
  codecs.lookup(encoding)
  return True
 except LookupError:
  return False

def validate_encoding ( encoding ) : try : codecs . lookup ( encoding ) return True except LookupError : return False
return true/false on whether the system understands this encoding .