code: def resolve_optional(type_v):
      """Deal with Optional implemented as Union[type, None]"""
      if (
          getattr(type_v, "__origin__", None) == Union
          and len(type_v.__args__) == 2
      ):
          if type_v.__args__[0] != type(None):
              return type_v.__args__[0]
          return type_v.__args__[1]
      return type_v
  
imports: from typing import Dict, List, Union
label_desc: Use image node_id 3 for calling a global function with example usage: resolve_optional(type_v) and returns: type_v, type_v, type_v