code: def from_protos(
      proto_list: List[american_option_pb2.AmericanEquityOption],
      config: "AmericanOptionConfig" = None,
  ) -> Dict[str, Any]:
      """Creates a dictionary of preprocessed swap data."""
      prepare_fras = {}
      for am_option_proto in proto_list:
          short_position = am_option_proto.short_position
          h, currency = _get_hash(am_option_proto)
          expiry_date = am_option_proto.expiry_date
          expiry_date = [
              expiry_date.year,
              expiry_date.month,
              expiry_date.day,
          ]
          equity = am_option_proto.equity
          contract_amount = instrument_utils.decimal_to_double(
              am_option_proto.contract_amount
          )
          business_day_convention = (
              business_days.convention_from_proto_value(
                  am_option_proto.business_day_convention
              )
          )
          strike = instrument_utils.decimal_to_double(
              am_option_proto.strike
          )
          calendar = business_days.holiday_from_proto_value(
              am_option_proto.bank_holidays
          )
          settlement_days = am_option_proto.settlement_days
          is_call_option = am_option_proto.is_call_option
          name = am_option_proto.metadata.id
          instrument_type = am_option_proto.metadata.instrument_type
          if h not in prepare_fras:
              prepare_fras[h] = {
                  "short_position": [short_position],
                  "currency": [currency],
                  "expiry_date": [expiry_date],
                  "equity": [equity],
                  "contract_amount": [contract_amount],
                  "business_day_convention": business_day_convention,
                  "calendar": calendar,
                  "strike": [strike],
                  "is_call_option": [is_call_option],
                  "settlement_days": [settlement_days],
                  "config": config,
                  "batch_names": [[name, instrument_type]],
              }
          else:
              prepare_fras[h]["short_position"].append(short_position)
              prepare_fras[h]["expiry_date"].append(expiry_date)
              prepare_fras[h]["equity"].append(equity)
              prepare_fras[h]["currency"].append(currency)
              prepare_fras[h]["contract_amount"].append(contract_amount)
              prepare_fras[h]["strike"].append(strike)
              prepare_fras[h]["is_call_option"].append(is_call_option)
              prepare_fras[h]["settlement_days"].append(settlement_days)
              prepare_fras[h]["batch_names"].append(
                  [name, instrument_type]
              )
      return prepare_fras
  
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 3 for calling a global function with example usage: from_protos(proto_list, config) and returns: prepare_fras