code: def hash_tuples(vals, encoding="utf8", hash_key=None):
      """
      Hash an MultiIndex / list-of-tuples efficiently
  
      .. versionadded:: 0.20.0
  
      Parameters
      ----------
      vals : MultiIndex, list-of-tuples, or single tuple
      encoding : string, default 'utf8'
      hash_key : string key to encode, default to _default_hash_key
  
      Returns
      -------
      ndarray of hashed values array
      """
      is_tuple = False
      if isinstance(vals, tuple):
          vals = [vals]
          is_tuple = True
      elif not is_list_like(vals):
          raise TypeError("must be convertible to a list-of-tuples")
  
      from pandas import Categorical, MultiIndex
  
      if not isinstance(vals, ABCMultiIndex):
          vals = MultiIndex.from_tuples(vals)
  
      # create a list-of-Categoricals
      vals = [
          Categorical(
              vals.codes[level],
              vals.levels[level],
              ordered=False,
              fastpath=True,
          )
          for level in range(vals.nlevels)
      ]
  
      # hash the list-of-ndarrays
      hashes = (
          _hash_categorical(cat, encoding=encoding, hash_key=hash_key)
          for cat in vals
      )
      h = _combine_hash_arrays(hashes, len(vals))
      if is_tuple:
          h = h[0]
  
      return h
  
file_path: catboost/contrib/python/pandas/py2/pandas/core/util/hashing.py
imports: import itertools
  import numpy
  from pandas._libs import hashing, tslibs
  from pandas.core.dtypes.cast import infer_dtype_from_scalar
  from pandas.core.dtypes.common import is_categorical_dtype, is_extension_array_dtype, is_list_like
  from pandas.core.dtypes.generic import ABCDataFrame, ABCIndexClass, ABCMultiIndex, ABCSeries
  from pandas.core.dtypes.missing import isna
label_desc: Use image node_id 3 for calling a global function with example usage: hash_tuples(vals, encoding, hash_key) and returns: h