class_docstr: Wrapper to interact with the Hive Metastore.
  
  :param metastore_conn_id: reference to the
      :ref: `metastore thrift service connection id <howto/connection:hive_metastore>`.
class_docstr_tok: ["Wrapper","to","interact","with","the","Hive","Metastore",".",":","param","metastore_conn_id",":","reference","to","the",":","ref",":","`","metastore","thrift","service","connection","id","<","howto\/connection",":","hive_metastore",">","`","."]
docstr: Get max partition of partitions with partition_key from part specs.
  
  key:value pair in filter_map will be used to filter out partitions.
  
  :param part_specs: list of partition specs.
  :param partition_key: partition key name.
  :param filter_map: partition_key:partition_value map used for partition filtering,
                     e.g. {'key1': 'value1', 'key2': 'value2'}.
                     Only partitions matching all partition_key:partition_value
                     pairs will be considered as candidates of max partition.
  :return: Max partition or None if part_specs is empty.
docstr_tok: ["Get","max","partition","of","partitions","with","partition_key","from","part","specs",".","key",":","value","pair","in","filter_map","will","be","used","to","filter","out","partitions",".",":","param","part_specs",":","list","of","partition","specs",".",":","param","partition_key",":","partition","key","name",".",":","param","filter_map",":","partition_key",":","partition_value","map","used","for","partition","filtering",",","e.g",".","{","'key1","'",":","'value1","'",",","'key2","'",":","'value2","'","}",".","Only","partitions","matching","all","partition_key",":","partition_value","pairs","will","be","considered","as","candidates","of","max","partition",".",":","return",":","Max","partition","or","None","if","part_specs","is","empty","."]
code: def _get_max_partition_from_part_specs(
      part_specs: list[Any],
      partition_key: str | None,
      filter_map: dict[str, Any] | None,
  ) -> Any:
      """
      Get max partition of partitions with partition_key from part specs.
  
      key:value pair in filter_map will be used to filter out partitions.
  
      :param part_specs: list of partition specs.
      :param partition_key: partition key name.
      :param filter_map: partition_key:partition_value map used for partition filtering,
                         e.g. {'key1': 'value1', 'key2': 'value2'}.
                         Only partitions matching all partition_key:partition_value
                         pairs will be considered as candidates of max partition.
      :return: Max partition or None if part_specs is empty.
      """
      if not part_specs:
          return None
  
      # Assuming all specs have the same keys.
      if partition_key not in part_specs[0].keys():
          raise AirflowException(
              f"Provided partition_key {partition_key} is not in part_specs."
          )
      if filter_map and not set(filter_map).issubset(part_specs[0]):
          raise AirflowException(
              f"Keys in provided filter_map {', '.join(filter_map.keys())} "
              f"are not subset of part_spec keys: {', '.join(part_specs[0].keys())}"
          )
  
      return max(
          (
              p_dict[partition_key]
              for p_dict in part_specs
              if filter_map is None
              or all(
                  item in p_dict.items() for item in filter_map.items()
              )
          ),
          default=None,
      )
  
imports: from __future__ import annotations
  import contextlib
  import os
  import re
  import socket
  import subprocess
  import time
  import warnings
  from tempfile import NamedTemporaryFile, TemporaryDirectory
  from typing import TYPE_CHECKING, Any, Iterable, Mapping
  from airflow.exceptions import AirflowProviderDeprecationWarning
  import csv
  from airflow.configuration import conf
  from airflow.exceptions import AirflowException
  from airflow.hooks.base import BaseHook
  from airflow.providers.common.sql.hooks.sql import DbApiHook
  from airflow.security import utils
  from airflow.utils.helpers import as_flattened_list
  from airflow.utils.operator_helpers import AIRFLOW_VAR_NAME_FORMAT_MAPPING
label_desc: Use image node_id 13 for calling the HiveMetastoreHook obj's underlying member method code with example usage: obj._get_max_partition_from_part_specs(part_specs, partition_key, filter_map) and returns: max, None