<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_length(self, itraj, stride=1, skip=0):
 r"""Returns the length of trajectory of the requested index. Parameters itraj : int trajectory index stride : int return value is the number of frames in the trajectory when running through it with a step size of `stride`. skip: int or None skip n frames. Returns ------- int : length of trajectory """

        if itraj >= self.ntraj:
            raise IndexError("given index (%s) exceeds number of data sets (%s)."
                             " Zero based indexing!" % (itraj, self.ntraj))
        if not IteratorState.is_uniform_stride(stride):
            selection = stride[stride[:, 0] == itraj][:, 0]
            return 0 if itraj not in selection else len(selection)
        else:
            res = max((self._lengths[itraj] - skip - 1) // int(stride) + 1, 0)
            return res