code: def update_leg(
      current_leg: Union[
          coupon_specs.FixedCouponSpecs, coupon_specs.FloatCouponSpecs
      ],
      leg: Union[
          coupon_specs.FixedCouponSpecs, coupon_specs.FloatCouponSpecs
      ],
  ):
      """Adds new leg info to the current leg."""
      if isinstance(current_leg, coupon_specs.FixedCouponSpecs):
          if not isinstance(leg, coupon_specs.FixedCouponSpecs):
              raise ValueError(
                  "Both `current_leg` and `leg` should beof the same "
                  "fixed or float type."
              )
          current_leg.notional_amount += leg.notional_amount
          current_leg.fixed_rate += leg.fixed_rate
          current_leg.settlement_days += leg.settlement_days
      else:
          if not isinstance(leg, coupon_specs.FloatCouponSpecs):
              raise ValueError(
                  "Both `current_leg` and `leg` should beof the same "
                  "fixed or float type."
              )
          current_leg.notional_amount += leg.notional_amount
          update_rate_index(
              current_leg.floating_rate_type, leg.floating_rate_type
          )
          current_leg.settlement_days += leg.settlement_days
          current_leg.spread += leg.spread
  
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 6 for calling a global function with example usage: update_leg(current_leg, leg) without return types