def valid_intervals(intervals):
if intervals.ndim != <NUM_LIT:2> or intervals.shape[-<NUM_LIT:1>] != <NUM_LIT:2>:<EOL><INDENT>raise ParameterError('<STR_LIT>')<EOL><DEDENT>if np.any(intervals[:, <NUM_LIT:0>] > intervals[:, <NUM_LIT:1>]):<EOL><INDENT>raise ParameterError('<STR_LIT>'.format(intervals))<EOL><DEDENT>return True<EOL>
Ensure that an array is a valid representation of time intervals:

        - intervals.ndim == 2
        - intervals.shape[1] == 2
        - intervals[i, 0] <= intervals[i, 1] for all i

    Parameters
    ----------
    intervals : np.ndarray [shape=(n, 2)]
        set of time intervals

    Returns
    -------
    valid : bool
        True if `intervals` passes validation.