def _get_num_variables(coeff_list):
    """
    Determine the number of variables by inspection of the coefficient list

    Parameters
    ----------
    coeff_list : Sequence

    Returns
    -------
    int
    """

    variables = None
    for entry in coeff_list:
        if isinstance(entry, int):
            if variables is None:
                variables = 1
            elif variables != 1:
                raise ValueError('Entry order mismatch')
        else:
            if variables is None:
                variables = len(entry)
            elif variables != len(entry):
                raise ValueError('Entry order mismatch')
    if variables is None:
        raise ValueError('Unable to determine the number of variables')
    return variables