code: def check_explain_conditions(
      method, models, X=None, treatment=None, y=None
  ):
      valid_methods = ["gini", "permutation", "shapley"]
      assert (
          method in valid_methods
      ), "Current supported methods: {}".format(
          ", ".join(valid_methods)
      )
  
      if method in ("gini", "shapley"):
          conds = [
              hasattr(mod, "feature_importances_") for mod in models
          ]
          assert all(
              conds
          ), "Both models must have .feature_importances_ attribute if method = {}".format(
              method
          )
  
      if method in ("permutation", "shapley"):
          assert all(
              arr is not None for arr in (X, treatment, y)
          ), "X, treatment, and y must be provided if method = {}".format(
              method
          )
  
file_path: causalml/causalml/inference/meta/utils.py
imports: import pandas
  import numpy
  from packaging import version
  from xgboost import __version__
label_desc: Use image node_id 4 for calling a global function with example usage: check_explain_conditions(method, models, X, treatment, y) without return types