code: def update_frequency(
      leg: Tuple[int, List[int]]
  ) -> dateslib.PeriodTensor:
      """Updates frequencies of a leg to an instance of PeriodTensor."""
      leg.coupon_frequency = market_data_utils.period_from_list(
          leg.coupon_frequency
      )
      try:
          leg.reset_frequency = market_data_utils.period_from_list(
              leg.reset_frequency
          )
      except AttributeError:
          pass
  
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 15 for calling a global function with example usage: update_frequency(leg) without return types