code: def _absval(equation, **kwds):
      verbose = kwds["verbose"] if "verbose" in kwds else False
      # find each top-level 'abs(' and the contents in the '()'
      # FIXME: should search for 'Xabs(' where X cannot be used in a name
      q = {}
      abs_ = "abs("
      fe0 = flat(equation, q)
      z = []
      for e in _enclosed(fe0):
          if abs_ in e:
              z.append(e[e.find(abs_) + 4 : -1])
  
      # prepare q.values as lists
      p = {}  # 'conditions'
      for k, v in q.items():
          if abs_ in v:
              q[k], p[k] = _absval(v, **kwds)
          else:
              q[k] = [v]
              p[k] = [""]
  
      if verbose:
          print("org: {0}".format(equation))
          print("sub: {0}".format(fe0))
          print("eqn: {0}".format(q))
          print("con: {0}".format(p))
  
      # build equations out of innards of abs() #NOTE: order is same as 'z'
      qz0 = [
          [
              (c.replace(NL, " >= 0\n", 1) if NL in c else c + " >= 0")
              for c in q[zi]
          ]
          for zi in z
      ]
  
      # generate all cases by replacing 'abs' with combinations of '' and '-'
      s = ["", "-"]
      re0 = []
      ze0 = []
  
      import itertools as it
  
      for si in it.product(s, repeat=fe0.count(abs_)):
          ze = []  # NOTE: order is same as 'z'
          re = fe0
          for i, j in enumerate(si):
              ze.append(
                  [
                      NL.join(flip(ii) for ii in jj.split(NL))
                      for jj in qz0[i]
                  ]
                  if j
                  else qz0[i]
              )  # XXX: flip(ii) or flip(ii,True)?
              re = re.replace("abs", j, 1)
          ze0.append(
              [
                  (NL + NL.join(i)).rstrip()
                  for i in it.product(*ze, repeat=1)
              ]
          )
          re0.append(re)
  
      # replace stubs with inner (sort to ensure same order as ze0)
      rz0 = []
      sorter = lambda i: (int(k.strip("$")), v)
      pk, pv = tuple(zip(*sorted(p.items(), key=sorter)))
      qk, qv = tuple(zip(*sorted(q.items(), key=sorter)))
  
      for re, ze in zip(re0, ze0):
          qkv = []
          for i, (qvi, pvi) in enumerate(
              zip(it.product(*qv), it.product(*pv))
          ):
              r_ = re
              for ki, vi in zip(qk, qvi):
                  r_ = r_.replace(ki, vi)  # replace stubs
              qkv.append(r_)
              ze[i] += "".join(pvi)  # include inner conditions
          rz0.append(qkv)
  
      if verbose:
          print("eqns: {0}".format(re0))
          print("cond: {0}".format(ze0))
      ze0 = list(it.chain.from_iterable(ze0))
      re0 = list(it.chain.from_iterable(rz0))
      return re0, ze0
  
imports: from numpy import ndarray, asarray, any
  from mystic._symbolic import solve
  from mystic.tools import list_or_tuple_or_ndarray, flatten
label_desc: Use image node_id 15 for calling a global function with example usage: _absval(equation) and returns: re0,  ze0