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, host
Best attempt to get username and hostname, returns "na" if problem.