code: def impose_median(m, samples, weights=None):
      """impose a median on a list of (weighted) points
          (this function is 'range-preserving' and 'mad-preserving')
  
      Inputs:
          m -- the target median
          samples -- a list of sample points
          weights -- a list of sample weights"""
      s = asarray(samples)
      return (s + (m - median(samples, weights))).tolist()
  
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 41 for calling a global function with example usage: impose_median(m, samples, weights) and returns: unknown