code: def process_curve_types(
      curve_types: List[
          Union[
              curve_types_lib.RiskFreeCurve,
              curve_types_lib.RateIndexCurve,
          ]
      ],
      mask=None,
  ) -> Tuple[
      List[
          Union[
              curve_types_lib.RiskFreeCurve,
              curve_types_lib.RateIndexCurve,
          ]
      ],
      List[int],
  ]:
      """Extracts unique curves and computes an integer mask.
  
      #### Example
      ```python
      curve_types = [RiskFreeCurve("USD"), RiskFreeCurve("AUD"),
                     RiskFreeCurve("USD")]
      process_curve_types(curve_types)
      # Returns [RiskFreeCurve("AUD"), RiskFreeCurve("USD")], [1, 0, 1]
      ```
      Args:
        curve_types: A list of either `RiskFreeCurve` or `RateIndexCurve`.
        mask: An optional integer mask for the sorted curve type sequence. If
          supplied, the function returns does not do anything and returns
          `(curve_types, mask)`.
  
      Returns:
        A Tuple of `(curve_list, mask)` where  `curve_list` is  a list of unique
        curves in `curve_types` and `mask` is a list of integers which is the
        mask for `curve_types`.
      """
  
      def _get_signature(curve):
          """Converts curve information to a string."""
          if isinstance(curve, curve_types_lib.RiskFreeCurve):
              return curve.currency.value
          elif isinstance(curve, curve_types_lib.RateIndexCurve):
              return (
                  curve.currency.value
                  + "_"
                  + curve.index.type.value
                  + "_"
                  + "_".join(curve.index.source)
                  + "_"
                  + "_".join(curve.index.name)
              )
          else:
              raise ValueError(f"{type(curve)} is not supported.")
  
      curve_list = to_list(curve_types)
      if mask is not None:
          return curve_list, mask
      curve_hash = [
          _get_signature(curve_type) for curve_type in curve_list
      ]
      hash_discount_map = {
          _get_signature(curve_type): curve_type
          for curve_type in curve_list
      }
      mask, mask_map, num_unique_discounts = create_mask(curve_hash)
      discount_curve_types = [
          hash_discount_map[mask_map[i]]
          for i in range(num_unique_discounts)
      ]
      return discount_curve_types, mask
  
imports: from typing import Optional, Tuple, Callable, Any, List, Union
  import numpy
  import tensorflow.compat.v2
  from tf_quant_finance import datetime
  from tf_quant_finance.experimental.pricing_platform.framework.core import curve_types
  from tf_quant_finance.experimental.pricing_platform.framework.core import processed_market_data
  from tf_quant_finance.experimental.pricing_platform.framework.core import types
  from tf_quant_finance.experimental.pricing_platform.framework.market_data import rate_curve
  from tf_quant_finance.experimental.pricing_platform.framework.market_data import utils
  from tf_quant_finance.experimental.pricing_platform.framework.rate_instruments import coupon_specs
  from tf_quant_finance.experimental.pricing_platform.instrument_protos import period_pb2
  from tf_quant_finance.math import pad
label_desc: Use image node_id 4 for calling a global function with example usage: process_curve_types(curve_types, mask) and returns: discount_curve_types,  mask, curve_list,  mask, curve, unknown