code: def _nested_split(params, npts):
      """
      splits a flat parameter list into a list of weights and a list of positions;
      weights and positions are expected to have the same dimensions (given by npts)
  
      Inputs:
          params -- a flat list of weights and positions (formatted as noted below)
          npts -- a tuple describing the shape of the target lists
  
      Examples:
          >>> nx = 3;  ny = 2;  nz = 1
          >>> par = ['wx']*nx + ['x']*nx + ['wy']*ny + ['y']*ny + ['wz']*nz + ['z']*nz
          >>> weights, positions = _nested_split(par, (nx,ny,nz))
          >>> weights
          [['wx','wx','wx'], ['wy','wy'], ['wz']]
          >>> positions
          [['x','x','x'], ['y','y'], ['z']]"""
      weights = []
      coords = []
      ind = 0
      for i in range(len(npts)):
          weights.append(params[ind : ind + npts[i]])
          ind += npts[i]
          coords.append(params[ind : ind + npts[i]])
          ind += npts[i]
      return weights, coords
  
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 59 for calling a global function with example usage: _nested_split(params, npts) and returns: weights,  coords