def _get_n_opt_and_check_type_nested_list_argument(candidate, argument_required, name):
    """Calculate number of inputs and check input types for argument
    that is expected as list/tuple or nested list/tuple.

    Args:
        candidate
            Argument

        argument_required (bool):
            Whether an empty argument is allowed

        name (str):
            Name of argument used in error message

    """
    msg = f"{name} has to be a list/tuple or a nested list/tuple."

    # No list or tuple
    if not isinstance(candidate, (list, tuple)):
        raise ValueError(msg)

    # Empty list/tuple
    elif len(candidate) == 0:
        n_optimizations = 1
        if argument_required:
            raise ValueError(f"{name} needs to be specified")

    # Nested list/tuple
    elif isinstance(candidate[0], (list, tuple)):
        n_optimizations = len(candidate)
        for c in candidate:
            if not isinstance(c, (list, tuple)):
                raise ValueError(msg)

    # Non-empty 1-dimensional list/tuple
    else:
        n_optimizations = 1
    return n_optimizations