code: def make_args_optional(cls, args: Set[str]):
      @wraps(cls)
      def wrapper(*args, **kwargs):
          return cls(*args, **kwargs)
  
      # Override signature
      sig = signature(cls)
      parameters = [
          p
          for p in sig.parameters.values()
          if p.name not in args or p.default != p.empty
      ]
      filtered_parameters = [
          p
          for p in sig.parameters.values()
          if p.name in args and p.default == p.empty
      ]
  
      index = [
          i for i, p in enumerate(parameters) if p.kind == p.VAR_KEYWORD
      ]
      index = len(parameters) if not index else index[0]
  
      for p in filtered_parameters:
          new_parameter = Parameter(
              p.name,
              p.POSITIONAL_OR_KEYWORD,
              default=None,
              annotation=Optional[p.annotation],
          )
          parameters.insert(index, new_parameter)
  
      sig = sig.replace(parameters=parameters, return_annotation=cls)
      wrapper.__signature__ = sig
  
      return wrapper
  
imports: import contextlib
  import functools
  import inspect
  from argparse import Namespace
  from functools import wraps
  from inspect import Parameter, signature
  from typing import Any, Callable, Dict, List, Optional, Set, Type, Union
  import pytorch_lightning
  from jsonargparse import ArgumentParser, class_from_function
  from lightning_utilities.core.overrides import is_overridden
  from pytorch_lightning import LightningModule, Trainer
  import flash
  from flash.core.data.data_module import DataModule
  from flash.core.utilities.lightning_cli import LightningArgumentParser, LightningCLI, SaveConfigCallback
  from flash.core.utilities.stability import beta
label_desc: Use image node_id 3 for calling a global function with example usage: make_args_optional(cls, args) and returns: wrapper, cls