code: def register_stop_handler(handler):
      if lp_flags.LP_WORKER_MANAGER_V2.value:
          worker_manager_v2.get_worker_manager().register_stop_handler(
              handler
          )
      else:
          return worker_manager.register_stop_handler(handler)
  
file_path: launchpad/launchpad/launch/worker_manager_migration.py
imports: from typing import Optional, Union
  from launchpad import flags
  from launchpad.launch import worker_manager
  from launchpad.launch import worker_manager_v2
label_desc: Use image node_id 3 for calling a global function with example usage: register_stop_handler(handler) and returns: worker_manager