code: def allowed_levels(levels: List["FlowBuildLevel"]):
      """Annotate a function so that it requires certain build level to run.
  
      Example:
  
      .. highlight:: python
      .. code-block:: python
  
          @build_required(FlowBuildLevel.RUNTIME)
          def foo():
              print(1)
  
      :param levels: required build level to run this function.
      :return: annotated function
      """
  
      def __build_level(func):
          @wraps(func)
          def arg_wrapper(self, *args, **kwargs):
              if hasattr(self, "_build_level"):
                  if self._build_level in levels:
                      return func(self, *args, **kwargs)
                  else:
                      raise FlowBuildLevelError(
                          f"build_level check failed for {func!r}, required level: {levels}, actual level: {self._build_level}"
                      )
              else:
                  raise AttributeError(
                      f'{self!r} has no attribute "_build_level"'
                  )
  
          return arg_wrapper
  
      return __build_level
  
imports: from functools import wraps
  from typing import TYPE_CHECKING, List
  from jina.excepts import FlowBuildLevelError
label_desc: Use image node_id 1 for calling a global function with example usage: allowed_levels(levels) and returns: __build_level, arg_wrapper, func