code: def build_backdoor_estimands_dict(
      treatment_names: List[str],
      outcome_names: List[str],
      observed_nodes: List[str],
      backdoor_sets: List[str],
      estimands_dict: Dict,
  ):
      """Build the final dict for backdoor sets by filtering unobserved variables if needed."""
      backdoor_variables_dict = {}
      observed_nodes = set(observed_nodes)
      is_identified = [
          set(bset["backdoor_set"]).issubset(observed_nodes)
          for bset in backdoor_sets
      ]
  
      if any(is_identified):
          logger.info("Causal effect can be identified.")
          backdoor_sets_arr = [
              list(bset["backdoor_set"])
              for bset in backdoor_sets
              if set(bset["backdoor_set"]).issubset(observed_nodes)
          ]
      else:  # there is unobserved confounding
          logger.warning("Backdoor identification failed.")
          backdoor_sets_arr = []
  
      for i in range(len(backdoor_sets_arr)):
          backdoor_estimand_expr = construct_backdoor_estimand(
              treatment_names, outcome_names, backdoor_sets_arr[i]
          )
          logger.debug(
              "Identified expression = " + str(backdoor_estimand_expr)
          )
          estimands_dict[
              "backdoor" + str(i + 1)
          ] = backdoor_estimand_expr
          backdoor_variables_dict[
              "backdoor" + str(i + 1)
          ] = backdoor_sets_arr[i]
      return estimands_dict, backdoor_variables_dict
  
imports: import itertools
  import logging
  from enum import Enum
  from typing import Dict, List, Optional, Union
  import networkx
  import sympy
  import sympy.stats
  from dowhy.causal_identifier.efficient_backdoor import EfficientBackdoor
  from dowhy.causal_identifier.identified_estimand import IdentifiedEstimand
  from dowhy.graph import check_dseparation, check_valid_backdoor_set, check_valid_frontdoor_set, check_valid_mediation_set, do_surgery, get_all_directed_paths, get_backdoor_paths, get_descendants, get_instruments, has_directed_path
  from dowhy.utils.api import parse_state
label_desc: Use image node_id 10 for calling a global function with example usage: build_backdoor_estimands_dict(treatment_names, outcome_names, observed_nodes, backdoor_sets, estimands_dict) and returns: estimands_dict,  backdoor_variables_dict