code: def _get_username_hostname():
      '''Best attempt to get username and hostname, returns "na" if problem.'''
      user = 'na'
      host = 'na'
      try:
          user = getpass.getuser()
      except Exception:
          pass
      try:
          host = socket.gethostname()
      except Exception:
          pass
      return user, hosf _get_username_hostname():
      '''Best attempt to get username and hostname, returns "na" if problem.'''
      user = 'na'
      host = 'na'
      try:
          user = getpass.getuser()
      except Exception:
          pass
      try:
          host = socket.gethostname()
      except Exception:
          pass
      return user, host
docs: Best attempt to get username and hostname, returns "na" if problem.