def _GuessCharset(text):
  """Guess the charset of a text.

  Args:
    text: a string (str) that is either a us-ascii string or a unicode that was
        encoded in utf-8.
  Returns:
    Charset needed by the string, either 'us-ascii' or 'utf-8'.
  """
  try:
    text.decode('us-ascii')
    return 'us-ascii'
  except __HOLE__:
    return 'utf-8'
dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/api/mail.py/_GuessCharset