code: def beam_ptransform_fn(fn: Callable[..., Any]) -> Callable[..., Any]:
      """Lazy version of `@beam.ptransform_fn`."""
  
      lazy_decorated_fn = None
  
      @functools.wraps(fn)
      def decorated(*args, **kwargs):
          nonlocal lazy_decorated_fn
          # Actually decorate the function only the first time it is called
          if lazy_decorated_fn is None:
              lazy_decorated_fn = (
                  lazy_imports.apache_beam.ptransform_fn(fn)
              )
          return lazy_decorated_fn(*args, **kwargs)
  
      return decorated
  
imports: import functools
  import importlib
  from typing import Any, Callable, TypeVar
  from tensorflow_datasets.core.utils import py_utils
label_desc: Use image node_id 2 for calling a global function with example usage: beam_ptransform_fn(fn) and returns: decorated, lazy_decorated_fn