def is_ascii_encoding(encoding):
 try:
  return (codecs.lookup(encoding).name == 'ascii')
 except LookupError:
  return False

def is_ascii_encoding ( encoding ) : try : return ( codecs . lookup ( encoding ) . name == 'ascii' ) except LookupError : return False
checks if a given encoding is ascii .