docs: def positions_to_contigs(positions):
      """Flattens and converts a positions array to a contigs array, if applicable.
      """
  
      if isinstance(positions, np.ndarray):
          flattened_positions = positions.flatten()
      else:
          try:
              flattened_positions = np.array(
                  [pos for contig in positions for pos in contig])
          except TypeError:
              flattened_positions = np.array(positions)
  
      if (np.diff(positions) == 0).any() and not (0 in set(positions)):
          warnings.warn("I detected identical consecutive nonzero values.")
          return positions
  
      n = len(flattened_positions)
      contigs = np.ones(n)
      counter = 0
      for i in range(1, n):
          if positions[i] == 0:
              counter += 1
              contigs[i] += counter
          else:
              contigs[i] = contigs[i - 1]
      return contigs