Get the local username

def get_local_user(username):
    """Get the local username"""
    try:
        _ = getpwnam(username)
        luser = username
    except KeyError:
        luser = getuser()
    return luser