def is_ascii_encodable(s):
 try:
  s.encode('ascii')
 except UnicodeEncodeError:
  return False
 except UnicodeDecodeError:
  return False
 except AttributeError:
  return False
 return True

def is_ascii_encodable ( s ) : try : s . encode ( 'ascii' ) except UnicodeEncodeError : return False except UnicodeDecodeError : return False except AttributeError : return False return True
check if argument encodes to ascii without error .