docs: def to_numpy_bins_with_mask(bins) -> Tuple[np.ndarray, np.ndarray]:
      """Numpy binning edges including gaps.
  
      Parameters
      ----------
      bins: array_like
          1-D (n) or 2-D (n, 2) array of edges
  
      Returns
      -------
      edges: np.ndarray
          all edges
      mask: np.ndarray
          List of indices that correspond to bins that have to be included
  
      Examples
      --------
      >>> to_numpy_bins_with_mask([0, 1, 2])
      (array([0.,   1.,   2.]), array([0, 1]))
  
      >>> to_numpy_bins_with_mask([[0, 1], [2, 3]])
      (array([0, 1, 2, 3]), array([0, 2])
      """
      bins = np.asarray(bins)
      if bins.ndim == 1:
          edges = bins
          if bins.shape[0] > 1:
              mask = np.arange(bins.shape[0] - 1)
          else:
              mask = []
      elif bins.ndim == 2:
          edges = []
          mask = []
          j = 0
          if bins.shape[0] > 0:
              edges.append(bins[0, 0])
              for i in range(bins.shape[0] - 1):
                  mask.append(j)
                  edges.append(bins[i, 1])
                  if bins[i, 1] != bins[i+1, 0]:
                      edges.append(bins[i+1, 0])
                      j += 1
                  j += 1
              mask.append(j)
              edges.append(bins[-1, 1])
      else:
          raise RuntimeError("to_numpy_bins_with_mask: array with dim=1 or 2 expected")
      if not np.all(np.diff(edges) > 0):
          raise RuntimeError("to_numpy_bins_with_mask: edges array not monotone.")
      return edges, mask