code: def config_to_dict(
      am_option_config: "AmericanOptionConfig",
  ) -> Dict[str, Any]:
      """Converts AmericanOptionConfig to a dictionary."""
      config = {
          "model": am_option_config.model,
          "discounting_curve": am_option_config.discounting_curve,
          "num_samples": am_option_config.num_samples,
          "num_calibration_samples": am_option_config.num_calibration_samples,
          "num_exercise_times": am_option_config.num_exercise_times,
          "seed": tf.convert_to_tensor(
              am_option_config.seed, name="seed"
          ),
      }
      return config
  
file_path: tf-quant-finance/tf_quant_finance/experimental/pricing_platform/framework/equity_instruments/american_option/proto_utils.py
imports: from typing import Any, List, Dict, Tuple, Optional
  import tensorflow.compat.v2
  from tf_quant_finance.experimental.pricing_platform.framework import utils
  from tf_quant_finance.experimental.pricing_platform.framework.core import business_days
  from tf_quant_finance.experimental.pricing_platform.framework.core import currencies
  from tf_quant_finance.experimental.pricing_platform.framework.core import curve_types
  from tf_quant_finance.experimental.pricing_platform.framework.core import types
  from tf_quant_finance.experimental.pricing_platform.framework.equity_instruments import utils
  from tf_quant_finance.experimental.pricing_platform.framework.rate_instruments import cashflow_streams
  from tf_quant_finance.experimental.pricing_platform.framework.rate_instruments import utils
  from tf_quant_finance.experimental.pricing_platform.instrument_protos import american_equity_option_pb2
label_desc: Use image node_id 5 for calling a global function with example usage: config_to_dict(am_option_config) and returns: config