code: def _check_policy_gains(policy_gains, is_serialized=False):
      if is_serialized:
          assert isinstance(policy_gains, CausalPolicyGains)
          recommended_policy_gains = (
              policy_gains.recommended_policy_gains
          )
          treatment_gains = policy_gains.treatment_gains
      else:
          assert isinstance(policy_gains, dict)
          recommended_policy_gains = policy_gains[
              "recommended_policy_gains"
          ]
          treatment_gains = policy_gains["treatment_gains"]
  
      assert isinstance(recommended_policy_gains, float)
  
      assert isinstance(treatment_gains, dict)
      for treatment_name, treatment_value in treatment_gains.items():
          assert isinstance(treatment_name, str)
          assert isinstance(treatment_value, float)
  
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 13 for calling a global function with example usage: _check_policy_gains(policy_gains, is_serialized) without return types