code: def get_handle(handle_like: HandleLike) -> metadata.Metadata:
      if isinstance(handle_like, MLMDConnectionManager):
          return cast(
              MLMDConnectionManager, handle_like
          ).get_mlmd_handle()
      else:
          return handle_like
  
file_path: tfx/tfx/orchestration/mlmd_connection_manager.py
imports: import contextlib
  import types
  from typing import Optional, Type, Union, cast
  from tfx.orchestration import metadata
  from ml_metadata.proto import metadata_store_pb2
label_desc: Use image node_id 1 for calling a global function with example usage: get_handle(handle_like) and returns: cast, handle_like