code: def _unpack(samples, npts):
      """'unpack' a list of product measure sample points 
  into a list of discrete measure sample points
  
  Inputs:
      samples -- a list of sample points for a product measure
      npts -- a tuple of dimensions of the target discrete measure
  
  Examples:
      >>> _unpack([(1,4,6), (2,4,6), (3,4,6), (1,5,6), (2,5,6), (3,5,6), \
      ...          (1,4,7), (2,4,7), (3,4,7), (1,5,7), (2,5,7), (3,5,7)], (3,2,2)\
      ...        )
      [[1,2,3], [4,5], [6,7]]
  """
      # from numpy import prod as product, array
      # ndim = len(npts)
      # z = []
      # for i in range(ndim):
      #   tmp = array(samples[:int(len(samples)/product(npts[i+1:]))]).T[i]
      #   z.append( list(tmp[::int(product(npts[:i]))]) )
      # return z
      _samples = []
      ndim = len(npts)
      temp = [npts[0]] * ndim
      _samples.append([j[0] for j in samples][: npts[0]])
  
      def recurse(next):
          if next == ndim:
              return
          else:
              temp[next] = temp[next - 1] * npts[next]
              currentindex = temp[next]
              lastindex = temp[next - 1]
              _samples.append(
                  [j[next] for j in samples][:currentindex:lastindex]
              )
              recurse(next + 1)
  
      recurse(1)
      return _samples
  
imports: from mystic.math.stats import *
  from mystic.math.samples import *
  from mystic.math.integrate import *
  from mystic.symbolic import generate_solvers, generate_constraint, solve
  from mystic.symbolic import generate_conditions, generate_penalty
  from mystic.math import almostEqual
  from mystic.math.distance import Lnorm
  from numpy import asarray
label_desc: Use image node_id 56 for calling a global function with example usage: _unpack(samples, npts) and returns: _samples