def check_length_of_shape_or_intercept_names(name_list,
                                             num_alts,
                                             constrained_param,
                                             list_title):
    """
    Ensures that the length of the parameter names matches the number of
    parameters that will be estimated. Will raise a ValueError otherwise.

    Parameters
    ----------
    name_list : list of strings.
        Each element should be the name of a parameter that is to be estimated.
    num_alts : int.
        Should be the total number of alternatives in the universal choice set
        for this dataset.
    constrainted_param : {0, 1, True, False}
        Indicates whether (1 or True) or not (0 or False) one of the type of
        parameters being estimated will be constrained. For instance,
        constraining one of the intercepts.
    list_title : str.
        Should specify the type of parameters whose names are being checked.
        Examples include 'intercept_params' or 'shape_params'.

    Returns
    -------
    None.
    """
    if len(name_list) != (num_alts - constrained_param):
        msg_1 = "{} is of the wrong length:".format(list_title)
        msg_2 = "len({}) == {}".format(list_title, len(name_list))
        correct_length = num_alts - constrained_param
        msg_3 = "The correct length is: {}".format(correct_length)
        total_msg = "\n".join([msg_1, msg_2, msg_3])
        raise ValueError(total_msg)

    return None