code: def call(entity: dict) -> str:
      # Special behavior for ensemble
      if "submodels" in entity["args"]:
          del entity["args"]["submodels"]
  
      for k, v in entity["args"].items():
          if not str(v).startswith("$"):
              if not is_allowed(v):
                  raise Exception(f"Invalid value: {v} for arg {k}")
  
      args = [
          f"{k}={v}"
          for k, v in entity["args"].items()
          if not str(v).startswith("$")
      ]
  
      for k, v in entity["args"].items():
          if str(v).startswith("$"):
              v = str(v).replace("$", "self.")
              args.append(f"{k}={v}")
  
      args = ",".join(args)
      return f"""{entity['module']}({args})"""
  
file_path: lightwood/lightwood/helpers/templating.py
imports: from typing import Callable
  from collections import deque
  import inspect
  import numpy
  from type_infer.dtype import dtype
label_desc: Use image node_id 2 for calling a global function with example usage: call(entity) and returns: entity, str, args, str