code: def log_nodes_cb(node, status):
      """Function to record node run statistics to a log file as json
      dictionaries
  
      Parameters
      ----------
      node : nipype.pipeline.engine.Node
          the node being logged
      status : string
          acceptable values are 'start', 'end'; otherwise it is
          considered and error
  
      Returns
      -------
      None
          this function does not return any values, it logs the node
          status info to the callback logger
      """
  
      if status != "end":
          return
  
      # Import packages
      import logging
      import json
  
      status_dict = {
          "name": node.name,
          "id": node._id,
          "start": getattr(node.result.runtime, "startTime"),
          "finish": getattr(node.result.runtime, "endTime"),
          "duration": getattr(node.result.runtime, "duration"),
          "runtime_threads": getattr(
              node.result.runtime, "cpu_percent", "N/A"
          ),
          "runtime_memory_gb": getattr(
              node.result.runtime, "mem_peak_gb", "N/A"
          ),
          "estimated_memory_gb": node.mem_gb,
          "num_threads": node.n_procs,
      }
  
      if status_dict["start"] is None or status_dict["finish"] is None:
          status_dict["error"] = True
  
      # Dump string to log
      logging.getLogger("callback").debug(json.dumps(status_dict))
  
imports: import os
  import numpy
  import threading
  from time import time
  from ..None import config, logging
label_desc: Use image node_id 1 for calling a global function with example usage: log_nodes_cb(node, status) without return types