code: def _wrap_op_fn(op_class, wrapper_name, wrapper_doc):
      def op_wrapper(*inputs, **kwargs):
          import nvidia.dali.ops
  
          init_args, call_args = nvidia.dali.ops._separate_kwargs(
              kwargs
          )
  
          default_dev = nvidia.dali.ops._choose_device(inputs)
          if default_dev == "gpu" and init_args.get("device") == "cpu":
              raise ValueError(
                  "An operator with device='cpu' cannot accept GPU inputs."
              )
  
          if "device" not in init_args:
              init_args["device"] = default_dev
  
          # TODO(klecki): It is now possible to handle creation of _OperatorInstance directly
          return op_class(**init_args)(*inputs, **call_args)
  
      def fn_wrapper(*inputs, **kwargs):
          from nvidia.dali._debug_mode import _PipelineDebug
  
          current_pipeline = _PipelineDebug.current()
          if getattr(current_pipeline, "_debug_on", False):
              return current_pipeline._wrap_op_call(
                  op_class, wrapper_name, *inputs, **kwargs
              )
          else:
              return op_wrapper(*inputs, **kwargs)
  
      from nvidia.dali.ops import _signatures
      from nvidia.dali import backend as _b
  
      fn_wrapper.__name__ = wrapper_name
      fn_wrapper.__qualname__ = wrapper_name
      fn_wrapper.__doc__ = wrapper_doc
      schema = _b.TryGetSchema(op_class.schema_name)
      if schema is not None:
          fn_wrapper.__signature__ = _signatures._call_signature(
              schema,
              include_inputs=True,
              include_kwargs=True,
              filter_annotations=True,
          )
      fn_wrapper._schema_name = op_class.schema_name
      fn_wrapper._generated = getattr(op_class, "_generated", False)
      return fn_wrapper
  
file_path: DALI/dali/python/nvidia/dali/fn/__init__.py
imports: import sys
  from nvidia.dali import backend
  from nvidia.dali import internal
  from nvidia.dali.external_source import external_source
label_desc: Use image node_id 3 for calling a global function with example usage: _wrap_op_fn(op_class, wrapper_name, wrapper_doc) and returns: fn_wrapper, op_class, current_pipeline, op_wrapper