code: def _coo_to_sparse_series(A, dense_index=False):
      """Convert a scipy.sparse.coo_matrix to a SparseSeries.
      Use the defaults given in the SparseSeries constructor.
      """
      s = Series(A.data, MultiIndex.from_arrays((A.row, A.col)))
      s = s.sort_index()
      s = s.to_sparse()  # TODO: specify kind?
      if dense_index:
          # is there a better constructor method to use here?
          i = range(A.shape[0])
          j = range(A.shape[1])
          ind = MultiIndex.from_product([i, j])
          s = s.reindex(ind)
      return s
  
imports: from pandas.compat import OrderedDict, lmap
  from pandas.core.index import Index, MultiIndex
  from pandas.core.series import Series
label_desc: Use image node_id 4 for calling a global function with example usage: _coo_to_sparse_series(A, dense_index) and returns: s