code: def _framework_implemented(torch: bool = True, tf2: bool = True):
      """Decorator to check if a model was implemented in a framework.
  
      Args:
          torch: Whether we can build this model with torch.
          tf2: Whether we can build this model with tf2.
  
      Returns:
          The decorated function.
  
      Raises:
          ValueError: If the framework is not available to build.
      """
      accepted = []
      if torch:
          accepted.append("torch")
      if tf2:
          accepted.append("tf2")
  
      def decorator(fn: Callable) -> Callable:
          @functools.wraps(fn)
          def checked_build(self, framework, **kwargs):
              if framework not in accepted:
                  raise ValueError(
                      f"This config does not support framework "
                      f"{framework}. Only frameworks in {accepted} are "
                      f"supported."
                  )
              return fn(self, framework, **kwargs)
  
          return checked_build
  
      return decorator
  
imports: import abc
  from dataclasses import dataclass, field
  import functools
  from typing import Callable, Dict, List, Optional, Tuple, TYPE_CHECKING, Union
  import numpy
  from ray.rllib.models.torch.misc import same_padding, same_padding_transpose_after_stride, valid_padding
  from ray.rllib.models.utils import get_activation_fn, get_initializer_fn
  from ray.rllib.utils.annotations import ExperimentalAPI
label_desc: Use image node_id 1 for calling a global function with example usage: _framework_implemented(torch, tf2) and returns: decorator, checked_build, fn