code: def DupFd(fd):
      """Return a wrapper for an fd."""
      popen_obj = get_spawning_popen()
      if popen_obj is not None:
          return popen_obj.DupFd(popen_obj.duplicate_for_child(fd))
      elif HAVE_SEND_HANDLE:
          from multiprocessing import resource_sharer
  
          return resource_sharer.DupFd(fd)
      else:
          raise TypeError(
              "Cannot pickle connection object. This object can only be "
              "passed when spawning a new process"
          )
  
file_path: catboost/contrib/python/joblib/joblib/externals/loky/backend/_posix_reduction.py
imports: import os
  import socket
  import _socket
  from multiprocessing.connection import Connection
  from multiprocessing.context import get_spawning_popen
  from .reduction import register
label_desc: Use image node_id 2 for calling a global function with example usage: DupFd(fd) and returns: popen_obj, resource_sharer