<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def bootstrap_counts_singletraj(dtraj, lagtime, n):
 """ Samples n counts at the given lagtime from the given trajectory """

    # check if length is sufficient
    L = len(dtraj)
    if (lagtime > L):
        raise ValueError(
            'Cannot sample counts with lagtime ' + str(lagtime) + ' from a trajectory with length ' + str(L))
    # sample
    I = np.random.randint(0, L - lagtime - 1, size=n)
    J = I + lagtime

    # return state pairs
    return (dtraj[I], dtraj[J])