code: def type_operator(input_type, label=None,
                    assert_type_for_arguments=True):
      
      def wrapper(func):
          func.is_operator = True
          func.label = label \
              or fn_name_to_pretty_label(func.__name__)
          func.input_type = input_type
  
          @wraps(func)
          def inner(self, *args, **kwargs):
              if assert_type_for_arguments:
                  args = [self._assert_valid_value_and_cast(arg) for arg in args]
                  kwargs = dict((k, self._assert_valid_value_and_cast(v))
                                for k, v in kwargs.items())
              return func(self, *args, **kwargs)
          return inner
      return wrapper
docs: Decorator to make a function into a type operator.
  
      - assert_type_for_arguments - if True this patches the operator function
        so that arguments passed to it will have _assert_valid_value_and_cast
        called on them to make type errors explicit.