code: def mad(samples, weights=None):  # , scale=1.4826):
      """calculate the (weighted) median absolute deviation for a list of points
  
      Inputs:
          samples -- a list of sample points
          weights -- a list of sample weights"""
      s = asarray(samples)
      return median(abs(s - median(samples, weights)), weights)
  
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 40 for calling a global function with example usage: mad(samples, weights) and returns: median