code: def from_protos_v2(
      proto_list: List[ir_swap.InterestRateSwap],
      config: "InterestRateSwapConfig" = None,
  ) -> Dict[str, Any]:
      """Creates a dictionary of preprocessed swap data."""
      prepare_swaps = {}
      for swap_proto in proto_list:
          pay_leg = swap_proto.pay_leg
          receive_leg = swap_proto.receive_leg
          h, flip_legs = get_hash_v2(swap_proto)
          start_date = swap_proto.effective_date
          start_date = [
              start_date.year,
              start_date.month,
              start_date.day,
          ]
          maturity_date = swap_proto.maturity_date
          maturity_date = [
              maturity_date.year,
              maturity_date.month,
              maturity_date.day,
          ]
          pay_leg_shuffled = leg_from_proto_v2(pay_leg)
          receive_leg_shuffled = leg_from_proto_v2(receive_leg)
          if flip_legs:
              notional_amount = receive_leg_shuffled.notional_amount
              receive_leg_shuffled.notional_amount = [
                  -el for el in notional_amount
              ]
              notional_amount = pay_leg_shuffled.notional_amount
              pay_leg_shuffled.notional_amount = [
                  -el for el in notional_amount
              ]
              pay_leg = receive_leg_shuffled
              receive_leg = pay_leg_shuffled
          else:
              pay_leg = pay_leg_shuffled
              receive_leg = receive_leg_shuffled
          name = swap_proto.metadata.id
          instrument_type = swap_proto.metadata.instrument_type
          if h in prepare_swaps:
              current_pay_leg = prepare_swaps[h]["pay_leg"]
              current_receive_leg = prepare_swaps[h]["receive_leg"]
              update_leg_v2(current_pay_leg, pay_leg)
              update_leg_v2(current_receive_leg, receive_leg)
              prepare_swaps[h]["start_date"].append(start_date)
              prepare_swaps[h]["maturity_date"].append(maturity_date)
              prepare_swaps[h]["batch_names"].append(
                  [name, instrument_type]
              )
          else:
              prepare_swaps[h] = {
                  "start_date": [start_date],
                  "maturity_date": [maturity_date],
                  "pay_leg": pay_leg,
                  "receive_leg": receive_leg,
                  "config": config,
                  "batch_names": [[name, instrument_type]],
              }
      return prepare_swaps
  
imports: from typing import Any, Dict, List, Tuple, Union
  import tensorflow.compat.v2
  from tf_quant_finance import datetime
  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 daycount_conventions
  from tf_quant_finance.experimental.pricing_platform.framework.core import rate_indices
  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.framework.rate_instruments import coupon_specs
  from tf_quant_finance.experimental.pricing_platform.framework.rate_instruments import utils
  from tf_quant_finance.experimental.pricing_platform.instrument_protos import interest_rate_swap_pb2
label_desc: Use image node_id 14 for calling a global function with example usage: from_protos_v2(proto_list, config) and returns: prepare_swaps