def match_event_roll_lengths(event_roll_a, event_roll_b, length=None):
    """Fix the length of two event rolls

    Parameters
    ----------
    event_roll_a: np.ndarray, shape=(m1,k)
        Event roll A

    event_roll_b: np.ndarray, shape=(m2,k)
        Event roll B

    length: int, optional
        Length of the event roll, if none given, shorter event roll is padded to match longer one.

    Returns
    -------
    event_roll_a: np.ndarray, shape=(max(m1,m2),k)
        Padded event roll A

    event_roll_b: np.ndarray, shape=(max(m1,m2),k)
        Padded event roll B

    """

    # Fix durations of both event_rolls to be equal
    if length is None:
        length = max(event_roll_b.shape[0], event_roll_a.shape[0])

    else:
        length = int(length)

    if length < event_roll_a.shape[0]:
        event_roll_a = event_roll_a[0:length, :]

    else:
        event_roll_a = pad_event_roll(
            event_roll=event_roll_a,
            length=length
        )

    if length < event_roll_b.shape[0]:
        event_roll_b = event_roll_b[0:length, :]

    else:
        event_roll_b = pad_event_roll(
            event_roll=event_roll_b,
            length=length
        )

    return event_roll_a, event_roll_b
Fix the length of two event rolls

    Parameters
    ----------
    event_roll_a: np.ndarray, shape=(m1,k)
        Event roll A

    event_roll_b: np.ndarray, shape=(m2,k)
        Event roll B

    length: int, optional
        Length of the event roll, if none given, shorter event roll is padded to match longer one.

    Returns
    -------
    event_roll_a: np.ndarray, shape=(max(m1,m2),k)
        Padded event roll A

    event_roll_b: np.ndarray, shape=(max(m1,m2),k)
        Padded event roll B