<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def trajectory_lengths(self, stride=1, skip=0):
 r""" Returns the length of each trajectory. Parameters stride : int return value is the number of frames of the trajectories when running through them with a step size of `stride`. skip : int skip parameter Returns ------- array(dtype=int) : containing length of each trajectory """

        n = self.ntraj

        if not IteratorState.is_uniform_stride(stride):
            return np.fromiter((self.trajectory_length(itraj, stride)
                                for itraj in range(n)),
                               dtype=int, count=n)
        else:
            return np.fromiter((self.trajectory_length(itraj, stride, skip)
                                for itraj in range(n)),
                               dtype=int, count=n)