code: def _get_keys_v2(leg: ir_swap.SwapLeg) -> Tuple[List[Any], List[Any]]:
      """Computes key values for a function that partitions swaps into batches."""
      if leg.HasField("fixed_leg"):
          fixed_leg = leg.fixed_leg
          key_1 = _fixed_leg_key_v2(fixed_leg)
          key_2 = 4 * [None]
      else:
          floating_leg = leg.floating_leg
          key_1 = 3 * [None]
          key_2 = _floating_leg_key_v2(floating_leg)
      # len(key_1) + len(key_2) = 7 - this is the number of features involved into
      # the batching procedure
      return key_1, key_2
  
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 22 for calling a global function with example usage: _get_keys_v2(leg) and returns: key_1,  key_2