code: def final_output(blob_or_record):
      """
      Adds an output to the current Task, or if no task is active,
      create a dummy task that returns the given blob or record
      to the client. This will return the value of the blob or record when
      the last task of the TaskGroup for a given node finishes.
      """
      cur_task = Task.current(required=False) or Task()
      return cur_task.add_output(blob_or_record)
  
imports: from caffe2.python import core, context
  from caffe2.python.schema import Field, from_blob_list
  from collections import defaultdict
  from copy import copy
label_desc: Use image node_id 4 for calling a global function with example usage: final_output(blob_or_record) and returns: cur_task