code: def convert_algo(algo_type, v1_algo):
      builtin_name = v1_algo.pop(
          f"builtin{algo_type.title()}Name", None
      )
      if builtin_name is not None:
          v2_algo = {"name": builtin_name}
  
      else:
          code_directory = v1_algo.pop("codeDir")
          class_file_name = v1_algo.pop("classFileName")
          assert class_file_name.endswith(".py")
          class_name = (
              class_file_name[:-3] + "." + v1_algo.pop("className")
          )
          v2_algo = {
              "className": class_name,
              "codeDirectory": code_directory,
          }
  
      if "classArgs" in v1_algo:
          v2_algo["classArgs"] = v1_algo.pop("classArgs")
  
      return v2_algo
  
imports: import copy
  import logging
label_desc: Use image node_id 5 for calling a global function with example usage: convert_algo(algo_type, v1_algo) and returns: v2_algo