code: def to_swagger_dict(config: Any) -> Any:
      """Converts a config object to a swagger API dict.
  
      This utility method recursively converts swagger code generated configs into
      a valid swagger dictionary. This method is trying to workaround a bug
      (https://github.com/swagger-api/swagger-codegen/issues/8948)
      from swagger generated code
  
      Args:
        config: The config object. It can be one of List, Dict or a Swagger code
          generated object, which has a `attribute_map` attribute.
  
      Returns:
        The original object with all Swagger generated object replaced with
        dictionary object.
      """
      if isinstance(config, list):
          return [to_swagger_dict(x) for x in config]
      if hasattr(config, "attribute_map"):
          return {
              swagger_name: to_swagger_dict(getattr(config, key))
              for (key, swagger_name) in config.attribute_map.items()
              if getattr(config, key)
          }
      if isinstance(config, dict):
          return {
              key: to_swagger_dict(value)
              for key, value in config.items()
          }
      return config
  
file_path: tfx/tfx/orchestration/launcher/container_common.py
imports: from typing import Any, Dict, List, Optional, Union
  import jinja2
  from tfx import types
  from tfx.dsl.component.experimental import executor_specs
  from tfx.dsl.component.experimental import placeholders
  from tfx.dsl.components.base import executor_spec
label_desc: Use image node_id 5 for calling a global function with example usage: to_swagger_dict(config) and returns: config, unknown, unknown, unknown