code: def save_to_file(self, filename, remap_dim0=None, remap_dim1=None):
      
      # rows - first index
      # columns - second index
      with open(filename, 'w') as fobj:
        columns = list(sorted(self._dim1))
        for col in columns:
          fobj.write(',')
          fobj.write(str(remap_dim1[col] if remap_dim1 else col))
        fobj.write('\n')
        for row in sorted(self._dim0):
          fobj.write(str(remap_dim0[row] if remap_dim0 else row))
          for col in columns:
            fobj.write(',')
            fobj.write(str(self[row, col]))
          fobj.write('\n')
docs: Saves matrix to the file.
  
      Args:
        filename: name of the file where to save matrix
        remap_dim0: dictionary with mapping row indices to row names which should
          be saved to file. If none then indices will be used as names.
        remap_dim1: dictionary with mapping column indices to column names which
          should be saved to file. If none then indices will be used as names.