code: def _process_config(
      config: Union[AmericanOptionConfig, Dict[str, Any], None]
  ) -> AmericanOptionConfig:
      """Converts config to AmericanOptionConfig."""
      if config is None:
          return AmericanOptionConfig()
      if isinstance(config, AmericanOptionConfig):
          return config
      model = config.get("model", "BS-LSM")
      seed = config.get("seed", [42, 42])
      num_exercise_times = config.get("num_exercise_times", 100)
      num_samples = config.get("num_samples", 96000)
      num_calibration_samples = config.get(
          "num_calibration_samples", None
      )
      discounting_curve = config.get("discounting_curve", dict())
      return AmericanOptionConfig(
          discounting_curve=discounting_curve,
          model=model,
          seed=seed,
          num_exercise_times=num_exercise_times,
          num_samples=num_samples,
          num_calibration_samples=num_calibration_samples,
      )
  
imports: from typing import Any, Optional, List, Dict, Union, Tuple
  import dataclasses
  import tensorflow.compat.v2
  from tf_quant_finance import datetime
  from tf_quant_finance.experimental.pricing_platform.framework.core import curve_types
  from tf_quant_finance.experimental.pricing_platform.framework.core import instrument
  from tf_quant_finance.experimental.pricing_platform.framework.core import processed_market_data
  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.equity_instruments.american_option import proto_utils
  from tf_quant_finance.experimental.pricing_platform.framework.equity_instruments.american_option import utils
  from tf_quant_finance.experimental.pricing_platform.framework.market_data import utils
  from tf_quant_finance.experimental.pricing_platform.framework.rate_instruments import cashflow_streams
  from tf_quant_finance.experimental.pricing_platform.instrument_protos import american_equity_option_pb2
label_desc: Use image node_id 1 for calling a global function with example usage: _process_config(config) and returns: AmericanOptionConfig, AmericanOptionConfig, config