docs: def check_boundaries(boundaries):
      # generate a complex number for each (x,y) pair
      xy = boundaries[:, 0] + 1j * boundaries[:, 1]
      """
      # for numpy > 1.9 , use:
      unique_values, indices, indices_rev, counts = np.unique(
          xy,
          return_index=True,
          return_inverse=True,
          return_counts=True)
      """
      # numpy 1.8 -->
      unique_values, indices, indices_rev = np.unique(
          xy,
          return_index=True,
          return_inverse=True)
      # now bin the indices we use to reconstruct the original array. Each index
      # that is present more than once will manifest in a bin with a number
      # larger than one. Use as many bins as there are indices.
      nr_bins = np.abs(indices_rev.min() - indices_rev.max()) + 1
      counts, b = np.histogram(indices_rev, bins=nr_bins)
      # <!-- numpy 1.8
  
      doublets = np.where(counts > 1)
      if doublets[0].size > 0:
          print('ERROR: Duplicate boundary coordinates found!')
          print('ERROR: Debug information')
          for doublet in doublets[0]:
              print('================')
              print('x y type:')
              print(boundaries[doublet, :])
              print('lines: ')
              print(np.where(indices_rev == doublet)[0])
          raise Exception('Duplicate boundary coordinates found!')