Returns the user id to a given user name. Returns ``None`` if the user does not exist.

    :param username: User name.
    :type username: unicode
    :return: User id.
    :rtype: int

def get_user_id(username):
    """
    Returns the user id to a given user name. Returns ``None`` if the user does not exist.

    :param username: User name.
    :type username: unicode
    :return: User id.
    :rtype: int
    """
    uid = single_line_stdout('id -u {0}'.format(username), expected_errors=(1,), shell=False)
    return check_int(uid)