code: def voight_painting(h):
      h = HaplotypeArray(np.asarray(h), copy=False)
      if h.max() > 1:
          raise NotImplementedError('only biallelic variants are supported')
      if h.min() < 0:
          raise NotImplementedError('missing calls are not supported')
      indices = h.prefix_argsort()
      h = np.take(h, indices, axis=1)
      painting = paint_shared_prefixes(memoryview_safe(np.asarray(h)))
      return painting, indices