code: def _check_policy(policy, config, is_serialized=False):
      if is_serialized:
          assert isinstance(policy, CausalPolicy)
          treatment_feature = policy.treatment_feature
          control_treatment = policy.control_treatment
          local_policies = policy.local_policies
          policy_gains = policy.policy_gains
          policy_tree = policy.policy_tree
      else:
          assert isinstance(policy, dict)
          treatment_feature = policy["treatment_feature"]
          control_treatment = policy["control_treatment"]
          local_policies = policy["local_policies"]
          policy_gains = policy["policy_gains"]
          policy_tree = policy["policy_tree"]
  
      _check_treatment_feature(treatment_feature)
      _check_control_treatment(control_treatment)
      _check_local_policies(local_policies, is_serialized=is_serialized)
      _check_policy_gains(policy_gains, is_serialized=is_serialized)
      _check_policy_tree(
          policy_tree, config, is_serialized=is_serialized
      )
  
imports: import numpy
  import pandas
  import pytest
  from econml.solutions.causal_analysis._causal_analysis import CausalAnalysis
  from raiutils.exceptions import UserConfigValidationException
  from raiutils.models import ModelTask
  from responsibleai._interfaces import CausalConfig, CausalData, CausalPolicy, CausalPolicyGains, CausalPolicyTreeInternal, CausalPolicyTreeLeaf
  from responsibleai._internal.constants import CausalManagerKeys, ListProperties, ManagerNames
  from responsibleai._tools.causal.causal_result import CausalResult
label_desc: Use image node_id 9 for calling a global function with example usage: _check_policy(policy, config, is_serialized) without return types