def get_bnumber_from_user_input(user_input):
    """
    The key used in the Sierra adapter VHS is the seven-digit form of a b-number.

    This function takes the user input, which could include the 'b' prefix or
    the check digit, and reduces it to the seven-digit form.
    """
    if (
        len(user_input) == len("b1234567x") or len(user_input) == len("b1234567")
    ) and user_input.startswith("b"):
        return user_input[1:8]
    elif len(user_input) == len("1234567") and user_input.isnumeric():
        return user_input
    else:
        raise ValueError(f"Not a valid bnumber: {user_input}")