<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def sprand(m, n, density, format='csr'):
 """Return a random sparse matrix. Parameters m, n : int shape of the result density : float target a matrix with nnz(A) = m*n*density, 0<=density<=1 format : string sparse matrix format to return, e.g. 'csr', 'coo', etc. Return ------ A : sparse matrix m x n sparse matrix Examples -------- """

    m, n = int(m), int(n)

    # get sparsity pattern
    A = _rand_sparse(m, n, density, format='csr')

    # replace data with random values
    A.data = sp.rand(A.nnz)

    return A.asformat(format)