code: def precondition(allow=ALL):
      """
      A helper decorator for value_inference method.
      Decorate value_inference with parameter VALUE/SYMBOL/NONE or ALL.
      For VALUE/SYMBOL/NONE use logical or ( | ) for multiple allowance.
      Note that:
          1. ALL == VALUE | SYMBOL | NONE
          2. Chosen flag (some or all VALUE/SYMBOL/NONE) must be satisfied
             by EVERY INPUTS for the precondition to be satisfied.
  
      The meaning for each flag is:
      VALUE: value that can be materialized during compile time
      SYMBOL: value that cannot be materialized by exist as a symbol value
      NONE: a None value
  
      Usage:
      @precondition(allow=VALUE|SYMBOL)
      def value_inference(self):
          '''some value_inference implementation'''
      """
      ALLOW_VALUE = allow & VALUE
      ALLOW_SYMBOL = allow & SYMBOL
      ALLOW_NONE = allow & NONE
  
      def process(v, has_value, has_symbol, has_none):
          """
          v: Var
  
          Return updated has_value, has_symbol, has_none
          """
          if any_symbolic(v.sym_val):
              return has_value, True, has_none
          elif v.val is None:
              return has_value, has_symbol, True
          return True, has_symbol, has_none
  
      def decorator(func):
          def wrapper(self):
              HAS_VALUE = False
              HAS_SYMBOL = False
              HAS_NONE = False
              for in_name, in_type in self._input_types.items():
                  if in_type.optional:
                      # Optional inputs are not required to invoke value_inference()
                      continue
  
                  if isinstance(in_type, TupleInputType):
                      for v in self._input_vars[in_name]:
                          HAS_VALUE, HAS_SYMBOL, HAS_NONE = process(
                              v, HAS_VALUE, HAS_SYMBOL, HAS_NONE
                          )
                  else:
                      HAS_VALUE, HAS_SYMBOL, HAS_NONE = process(
                          self._input_vars[in_name],
                          HAS_VALUE,
                          HAS_SYMBOL,
                          HAS_NONE,
                      )
  
              if HAS_VALUE and not ALLOW_VALUE:
                  msg = "Implementation of value_inference() for op {} doesn't support input with VALUE"
                  raise NotImplementedError(msg.format(self.op_type))
              elif HAS_SYMBOL and not ALLOW_SYMBOL:
                  msg = "Implementation of value_inference() for op {} doesn't support input with SYMBOL"
                  raise NotImplementedError(msg.format(self.op_type))
              elif HAS_NONE and not ALLOW_NONE:
                  msg = "Implementation of value_inference() for op {} doesn't support input with NONE"
                  raise NotImplementedError(msg.format(self.op_type))
              else:
                  return func(self)
  
          return wrapper
  
      return decorator
  
imports: from typing import Any, Dict, Tuple
  import numpy
  from coremltools.converters.mil.mil import types
  from coremltools.converters.mil.mil.types import is_compatible_type
  from coremltools.converters.mil.mil.types.symbolic import any_symbolic, is_symbolic
  from .None import SPACES
  from .input_type import DefaultInputs, TensorInputType, TupleInputType
  from .var import ComplexVar, InternalVar, ListVar, Var
label_desc: Use image node_id 2 for calling a global function with example usage: precondition(allow) and returns: decorator, True,  has_symbol,  has_none, wrapper, has_value,  True,  has_none, has_value,  has_symbol,  True, func