code: def _sort(samples, weights=None):
      "sort (weighted) samples; returns 2-D array of samples and weights"
      import numpy as np
  
      if weights is None:
          x = np.ones((2, len(samples)))  # XXX: casts to a float
          x[0] = np.sort(samples)
          return x
      x = np.vstack([samples, weights]).T
      return x[x[:, 0].argsort()].T
  
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 38 for calling a global function with example usage: _sort(samples, weights) and returns: x, x