docs: def fill_sparse_pyramid_level(pyramid_handle, level, contact_file, nfrags):
      """Fill a level with sparse contact map data
  
      Fill values from the simple text matrix file to the hdf5-based pyramid
      level with contact data.
      
      Parameters
      ----------
      pyramid_handle : h5py.File
          The hdf5 file handle containing the whole dataset.
      level : int
          The level (resolution) to be filled with contact data.
      contact_file : str, file or pathlib.Path
          The binned contact map file to be converted to hdf5 data.
      nfrags : int
          The number of fragments/bins in that specific level.
      """
  
      sparse_dict = dict()
      h = open(contact_file, "r")
      all_lines = h.readlines()
      n_lines = len(all_lines)
      for i in range(1, n_lines):
  
          line = all_lines[i]
          dat = line.split()
          mates = [int(dat[0]), int(dat[1])]
          nc = int(dat[2])
          mates.sort()
          f1 = mates[0]
          f2 = mates[1]
  
          if f1 in sparse_dict:
              if f2 in sparse_dict[f1]:
                  sparse_dict[f1][f2] += nc
              else:
                  sparse_dict[f1][f2] = nc
          else:
              sparse_dict[f1] = dict()
              sparse_dict[f1][f2] = nc
  
      keys = list(sparse_dict.keys())
      keys.sort()
  
      out_r = []
      out_c = []
      out_d = []
  
      for r in keys:
          data = sparse_dict[r]
          for c in list(data.keys()):
              out_r.append(r)
              out_c.append(c)
              out_d.append(data[c])
  
      n_on_pxls = len(out_d)
      level_hdf5 = pyramid_handle.create_group(str(level))
      data_2_sparse = level_hdf5.create_dataset("data", (3, n_on_pxls), "i")
      data_nfrags = level_hdf5.create_dataset("nfrags", (1, 1), "i")
      np_csr = np.zeros((3, n_on_pxls), dtype=np.int32)
      np_csr[0, :] = out_r
      np_csr[1, :] = out_c
      np_csr[2, :] = out_d
      data_2_sparse[0, :] = out_r
      data_2_sparse[1, :] = out_c
      data_2_sparse[2, :] = out_d
      data_nfrags[:] = nfrags