def METHOD_NAME(i, test_pulse=True):
    """
    Determine the start index, and end index of a general stimulus.
    Parameters
    ----------
    i   : numpy array
        current
    test_pulse: bool
        True if test pulse is assumed
    Returns
    -------
    start,end: int tuple
    """
    di = np.diff(i)
    di_idx = np.flatnonzero(di)   # != 0
    if test_pulse:
        di_idx = di_idx[2:]     # drop the first up/down (test pulse) if present
    if len(di_idx) < 2:    # if no stimulus is found
        return None
    start_idx = di_idx[0] + 1   # shift by one to compensate for diff()
    end_idx = di_idx[-1]
    return start_idx, end_idx