code: def separate_process_wrapper_fn(
      func: Callable[[], None], do_multi_processing: bool
  ) -> Callable[[], None]:
      """
      This function wraps another function into its own separated process.
      In order to ensure accurate memory measurements it is important that the function
      is executed in a separate process
  
      Args:
          - `func`: (`callable`): function() -> ...
              generic function which will be executed in its own separate process
          - `do_multi_processing`: (`bool`)
              Whether to run function on separate process or not
      """
  
      def multi_process_func(*args, **kwargs):
          # run function in an individual
          # process to get correct memory
          def wrapper_func(queue: Queue, *args):
              try:
                  result = func(*args)
              except Exception as e:
                  logger.error(e)
                  print(e)
                  result = "N/A"
              queue.put(result)
  
          queue = Queue()
          p = Process(target=wrapper_func, args=[queue] + list(args))
          p.start()
          result = queue.get()
          p.join()
          return result
  
      if do_multi_processing:
          logging.info(
              "fFunction {func} is executed in its own process..."
          )
          return multi_process_func
      else:
          return func
  
imports: import copy
  import csv
  import linecache
  import logging
  import os
  import platform
  import sys
  import timeit
  import numpy
  import gluonnlp
  from gluonnlp.models import get_backbone
  from gluonnlp.utils.misc import logging_config
  from gluonnlp.utils.lazy_imports import try_import_tvm
  from collections import defaultdict, namedtuple
  from datetime import datetime
  import multiprocessing
  from multiprocessing import Pipe, Process, Queue
  from multiprocessing.connection import Connection
  from typing import Callable, Iterable, List, NamedTuple, Optional, Union, Tuple
label_desc: Use image node_id 6 for calling a global function with example usage: separate_process_wrapper_fn(func, do_multi_processing) and returns: result, multi_process_func, func