<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def jtosparse(j):

 """
 Generate sparse matrix coordinates from 3-D Jacobian.
 """

    data = j.flatten().tolist()
    nobs, nf, nargs = j.shape
    indices = zip(*[(r, c) for n in xrange(nobs)
                    for r in xrange(n * nf, (n + 1) * nf)
                    for c in xrange(n * nargs, (n + 1) * nargs)])
    return csr_matrix((data, indices), shape=(nobs * nf, nobs * nargs))