(username)
Remove user from system if exists
Remove user from system if exists
Remove user from system if exists
def remove_user(username):
    """
    Remove user from system if exists
    """
    try:
        pwd.getpwnam(username)
    except KeyError:
        # User doesn't exist, nothing to do
        return

    subprocess.check_call(["deluser", "--quiet", username])
def remove_user ( username ) : try : pwd . getpwnam ( username ) except KeyError : # User doesn't exist, nothing to do return subprocess . check_call ( [ "deluser" , "--quiet" , username ] )