code: def validate_lmc(
      causal_graph: DirectedGraph,
      data: pd.DataFrame,
      p_values_memory: Optional[_PValuesMemory] = None,
      independence_test: Callable[
          [np.ndarray, np.ndarray], float
      ] = kernel_based,
      conditional_independence_test: Callable[
          [np.ndarray, np.ndarray, np.ndarray], float
      ] = kernel_based,
      significance_level: float = 0.05,
      include_unconditional: bool = True,
      n_jobs: Optional[int] = None,
  ) -> Dict[str, Union[int, Dict[str, float]]]:
      """
      Validate the local markov condition for a given directed graph. Return number of violations and p values for each
      node.
  
      :param causal_graph: A directed acyclic graph (DAG).
      :param data: Observations of variables in the DAG.
      :param p_values_memory: _PValuesMemory instance, where results of previously performed tests are stored.
      :param independence_test: Test to use for unconditional independencies (only used if include_unconditional=True)
      :param conditional_independence_test: Conditional independence test to use for checking local Markov condition.
      :param significance_level: Significance level for (conditional) independence tests.
      :param include_unconditional: Test also unconditional independencies of root nodes.
      :param n_jobs: Number of jobs to use for parallel execution of (conditional) independence tests.
      :return: Outcome of validation containing number of violations in the graph and p values/violation for each tuple
          (node, non_desc)
      """
      n_jobs = config.default_n_jobs if n_jobs is None else n_jobs
  
      if p_values_memory is None:
          p_values_memory = _PValuesMemory()
  
      validation_summary = {
          FalsifyConst.METHOD: FalsifyConst.VALIDATE_LMC,
          FalsifyConst.N_VIOLATIONS: 0,
          FalsifyConst.N_TESTS: 0,
          FalsifyConst.P_VALUES: dict(),
      }
  
      # Find out which tests to do
      triples = _get_parental_triples(
          causal_graph, include_unconditional
      )
      to_test = []
      for node, non_desc, parents in triples:
          if not (node, non_desc, parents) in p_values_memory:
              to_test.append((node, non_desc, parents))
              p_values_memory.add_p_value(
                  None, node, non_desc, parents
              )  # Placeholder
  
      # Parallelize over tests
      random_seeds = np.random.randint(
          np.iinfo(np.int32).max, size=len(to_test)
      )
      p_values = Parallel(n_jobs=n_jobs)(
          delayed(_compute_p_value)(
              data=data,
              X=node,
              Y=non_desc,
              Z=parents,
              independence_test=independence_test,
              conditional_independence_test=conditional_independence_test,
              seed=int(seed),
          )
          for (node, non_desc, parents), seed in zip(
              to_test, random_seeds
          )
      )
  
      # Gather results
      for i, (node, non_desc, parents) in enumerate(to_test):
          p_values_memory.add_p_value(
              p_values[i], node, non_desc, parents
          )
  
      # Summarize
      for node, non_desc, parents in triples:
          lmc_p_value = p_values_memory.get_p_value(
              node, non_desc, parents
          )
          if lmc_p_value is not None:
              validation_summary[FalsifyConst.N_TESTS] += 1
              validation_summary[FalsifyConst.P_VALUES][
                  (node, non_desc)
              ] = (
                  lmc_p_value,
                  lmc_p_value <= significance_level,
              )
              if lmc_p_value <= significance_level:
                  validation_summary[FalsifyConst.N_VIOLATIONS] += 1
      return validation_summary
  
imports: import warnings
  from dataclasses import dataclass, field
  from enum import Enum, auto
  from functools import partial
  from inspect import getfullargspec
  from itertools import permutations
  from typing import Any, Callable, Dict, FrozenSet, List, Optional, Set, Tuple, Union
  import matplotlib.colors
  import matplotlib.pyplot
  import networkx
  import numpy
  import pandas
  from joblib import Parallel, delayed
  from tqdm import tqdm
  import dowhy.gcm.config
  from dowhy.gcm.independence_test import kernel_based
  from dowhy.gcm.util import plot
  from dowhy.gcm.util.general import set_random_seed
  from dowhy.graph import DirectedGraph, get_ordered_predecessors
label_desc: Use image node_id 1 for calling a global function with example usage: validate_lmc(causal_graph, data, p_values_memory, independence_test, conditional_independence_test, significance_level, include_unconditional, n_jobs) and returns: validation_summary