code: def require_not_initialized(exception):
      """
      Decorator for API methods that should only be called during or before
      TradingAlgorithm.initialize.  `exception` will be raised if the method is
      called after initialize.
  
      Examples
      --------
      @require_not_initialized(SomeException("Don't do that!"))
      def method(self):
          # Do stuff that should only be allowed during initialize.
      """
  
      def decorator(method):
          @wraps(method)
          def wrapped_method(self, *args, **kwargs):
              if self.initialized:
                  raise exception
              return method(self, *args, **kwargs)
  
          return wrapped_method
  
      return decorator
  
file_path: zipline/zipline/utils/api_support.py
imports: import zipline.api
  from zipline.utils.compat import wraps
  from zipline.utils.algo_instance import get_algo_instance, set_algo_instance
label_desc: Use image node_id 2 for calling a global function with example usage: require_not_initialized(exception) and returns: decorator, wrapped_method, method