def _PrintOneUser(user, basic=True):
  """Prints fields from returned user json.

  Available fields include:
    agreedToTerms, changePasswordAtNextLogin, creationTime, customerId,
    emails, id, includeInGlobalAddressList, ipWhitelisted, isAdmin,
    isDelegatedAdmin, isMailboxSetup, kind, lastLoginTime,
    name ({'familyName': 'xx', 'fullName': 'yy', 'givenName': 'zz'}),
    nonEditableAliases, orgUnitPath, primaryEmail and suspended.
  Special handling is needed for:
    emails, name, nonEditableAliases, name: sort for deterministic output.

  Args:
    user: user json object returned from the users API list().
    basic: if True, only print 3 common fields otherwise print all fields.
  """
  _PrintOneLine(user['primaryEmail'], user['id'], user['name']['fullName'])
  if basic:
    return
  for field in sorted(user.keys()):
    if ('primaryEmail', 'id', 'fullName') in field:  # already displayed.
      continue
    # For deterministic output, need to pprint container objects like
    # dict. Textwrap is used for the hanging indent.  We use a hanging
    # indent of 7 because 4 spaces is the normal margin and the extra
    # 3 spaces are used for: colon, space and opening brace.
    formatted_text = textwrap.fill(
        pprint.pformat(user.get(field)),
        subsequent_indent=(7+len(field)) * ' ', break_on_hyphens=False)
    print '    %s: %s' % (field, formatted_text)
dataset/ETHPy150Open google/gfw-toolkit/api_sample/usertool.py/_PrintOneUser/swapped operands of `in`