<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def scipy_sparse_to_csv(filepath, matrix, separator=",", directed=False, numbering="matlab"):
 """ Writes sparse matrix in separated value format. """

    matrix = spsp.coo_matrix(matrix)

    shape = matrix.shape
    nnz = matrix.getnnz()

    if numbering == "matlab":
        row = matrix.row + 1
        col = matrix.col + 1
        data = matrix.data
    elif numbering == "c":
        row = matrix.row
        col = matrix.col
        data = matrix.data
    else:
        print("Invalid numbering style.")
        raise RuntimeError

    with open(filepath, "w") as f:
        # Write metadata.
        file_row = "n_rows:" + separator + str(shape[0]) + separator +\
                   "n_cols:" + separator + str(shape[1]) + separator +\
                   "nnz:" + separator + str(nnz) + separator +\
                   "directed:" + separator + str(directed) +\
                   "\n"
        f.write(file_row)

        for edge in range(row.size):
            if directed is False:
                if col[edge] < row[edge]:
                    continue
            file_row = str(row[edge]) + separator + str(col[edge]) + separator + str(data[edge]) + "\n"
            f.write(file_row)