code: def _ite(f, g, h):
      
      # ITE(f, 1, 0) = f
      if g is BDDNODEONE and h is BDDNODEZERO:
          return f
      # ITE(f, 0, 1) = f'
      elif g is BDDNODEZERO and h is BDDNODEONE:
          return _neg(f)
      # ITE(1, g, h) = g
      elif f is BDDNODEONE:
          return g
      # ITE(0, g, h) = h
      elif f is BDDNODEZERO:
          return h
      # ITE(f, g, g) = g
      elif g is h:
          return g
      else:
          # ITE(f, g, h) = ITE(x, ITE(fx', gx', hx'), ITE(fx, gx, hx))
          root = min(node.root for node in (f, g, h) if node.root > 0)
          npoint0 = {root: BDDNODEZERO}
          npoint1 = {root: BDDNODEONE}
          fv0, gv0, hv0 = [_restrict(node, npoint0) for node in (f, g, h)]
          fv1, gv1, hv1 = [_restrict(node, npoint1) for node in (f, g, h)]
          return _bddnode(root, _ite(fv0, gv0, hv0), _ite(fv1, gv1, hv1))
docs: Return node that results from recursively applying ITE(f, g, h).