code: def validate_common_state_directories(path, task_type):
      all_other_files = os.listdir(path)
      assert SerializationAttributes.RAI_VERSION_JSON in all_other_files
      assert SerializationAttributes.META_JSON in all_other_files
      assert SerializationAttributes.MODEL_PKL in all_other_files
  
      model = None
      with open(path / SerializationAttributes.MODEL_PKL, "rb") as file:
          model = pickle.load(file)
  
      predictions_path = (
          path / SerializationAttributes.PREDICTIONS_DIRECTORY
      )
      assert predictions_path.exists()
      all_predictions_files = os.listdir(predictions_path)
      if model is not None:
          assert (
              SerializationAttributes.PREDICT_JSON
              in all_predictions_files
          )
          if task_type == ModelTask.CLASSIFICATION:
              assert (
                  SerializationAttributes.PREDICT_PROBA_JSON
                  in all_predictions_files
              )
          else:
              assert (
                  SerializationAttributes.PREDICT_PROBA_JSON
                  not in all_predictions_files
              )
      else:
          assert len(all_predictions_files) == 0
  
      data_path = path / SerializationAttributes.DATA_DIRECTORY
      assert data_path.exists()
      all_data_files = os.listdir(data_path)
      assert "train.json" in all_data_files
      assert "traindtypes.json" in all_data_files
      assert "test.json" in all_data_files
      assert "testdtypes.json" in all_data_files
  
imports: import os
  import pickle
  from pathlib import Path
  from tempfile import TemporaryDirectory
  import numpy
  import pandas
  import pytest
  from tests.causal_manager_validator import validate_causal
  from tests.common_utils import create_iris_data
  from tests.counterfactual_manager_validator import validate_counterfactual
  from tests.error_analysis_validator import setup_error_analysis, validate_error_analysis
  from tests.explainer_manager_validator import setup_explainer, validate_explainer
  from rai_test_utils.datasets.tabular import create_binary_classification_dataset, create_cancer_data, create_housing_data
  from rai_test_utils.models.model_utils import create_models_classification, create_models_regression
  from rai_test_utils.models.sklearn import create_complex_classification_pipeline
  from rai_test_utils.utilities import is_valid_uuid
  from raiutils.models import ModelTask
  from responsibleai import RAIInsights
  from responsibleai._internal.constants import ManagerNames, SerializationAttributes
  from responsibleai._tools.shared.state_directory_management import DirectoryManager
  from responsibleai.feature_metadata import FeatureMetadata
label_desc: Use image node_id 2 for calling a global function with example usage: validate_common_state_directories(path, task_type) without return types