def clip_data(x_s, y_s):
    """
        In the case that there are different number of iterations
        across learning trials, clip all trials to the length of the shortest
        trial.

        Parameters:
            x_s - A list of lists of total timesteps so far per seed.
            y_s - A list of lists of average episodic return per seed

        Return: 
            x_s and y_s after clipping both. 
    """
    # Find shortest trial length
    x_len_min = min([len(x) for x in x_s])
    y_len_min = min([len(y) for y in y_s])

    len_min = min([x_len_min, y_len_min])

    # Clip each trial in x_s to shortest trial length
    for i in range(len(x_s)):
        x_s[i] = x_s[i][:len_min]

    # Clip each trial in y_s to shortest trial length
    for i in range(len(y_s)):
        y_s[i] = y_s[i][:len_min]
       
    return x_s, y_s