code: def resolve_defaults(func):
      """
      Use this decorator to resolve default field values in the constructor.
      """
  
      func_params = list(signature(func).parameters.values())
  
      @functools.wraps(func)
      def wrapper(*args, **kwargs):
          if len(args) > len(func_params):
              raise ValueError(
                  f"There are {len(func_params)} parameters in total, "
                  f"but args is {len(args)} long. \n"
                  f"{args}"
              )
          # go through unprovided default kwargs
          for p in func_params[len(args) :]:
              # only resolve defaults for Fields
              if isinstance(p.default, Field):
                  if p.name not in kwargs:
                      kwargs[p.name] = _resolve_default(p.default)
          return func(*args, **kwargs)
  
      return wrapper
  
file_path: ReAgent/reagent/core/configuration.py
imports: import functools
  from dataclasses import Field, fields, MISSING
  from inspect import isclass, Parameter, signature
  from typing import List, Optional, Type, Union
  from reagent.core.dataclasses import dataclass
  from torch import nn
label_desc: Use image node_id 4 for calling a global function with example usage: resolve_defaults(func) and returns: wrapper, func