def __overlap(bin_mask, lst, i, b):
    """
    Recursive, helper method, to compare the start and stop time points of
    two neighbouring trials
    (actual and next element in list).

    Parameters
    ----------
    bin_mask: numpy.ndarray
        A mask with 1's or 0's, to see which trial is overlapping. 1 means
        no overlap and 0 means overlap.
        Corresponds to trial ID.
    lst: list of tuples of int
        A list with the trials.
    i: int
        Actual position in `lst`.
    b: bool
        A boolean variable which will be returned. Indicates if a trial is
        valid or not.

    Returns
    -------
    valid: bool
        A boolean variable to indicate if a trial is valid or not.

    Notes
    -----
    Algorithm compares actual element i (trial_1) with next element i+1
    (trial_2) from the list. List contains
    tuple of trial IDs and tuple of start and stop points per trial.
    The list is ordered according to the smallest
    start point.
    Each step in the calling function (__check_trial_has_no_overlap()) an
    element of the list will be picked out.
    If it is not flagged as an overlapping trial.
    """
    valid = b
    if i + 1 >= len(lst):
        return valid
    else:
        # Get the actual and next element of list
        trial_1 = lst[i]
        trial_2 = lst[i + 1]
        # If start time of second trial is smaller
        # than stop time of actual trial
        if trial_2[1][0] < trial_1[1][1]:
            bin_mask[i] = 0
            bin_mask[i + 1] = 0
            valid = False
            __overlap(bin_mask, lst, i + 1, valid)
    return valid