code: def read_data_by_config(config: dict):
      """Read data by dataset_reader from specified config."""
      dataset_config = config.get("dataset", None)
  
      if dataset_config:
          config.pop("dataset")
          ds_type = dataset_config["type"]
          if ds_type == "classification":
              reader = {"class_name": "basic_classification_reader"}
              iterator = {"class_name": "basic_classification_iterator"}
              config["dataset_reader"] = {**dataset_config, **reader}
              config["dataset_iterator"] = {
                  **dataset_config,
                  **iterator,
              }
          else:
              raise Exception(
                  "Unsupported dataset type: {}".format(ds_type)
              )
  
      try:
          reader_config = dict(config["dataset_reader"])
      except KeyError:
          raise ConfigError(
              "No dataset reader is provided in the JSON config."
          )
  
      reader = get_model(reader_config.pop("class_name"))()
      data_path = reader_config.get("data_path")
      if isinstance(data_path, list):
          reader_config["data_path"] = [
              expand_path(path) for path in data_path
          ]
      elif data_path is not None:
          reader_config["data_path"] = expand_path(data_path)
      return reader.read(**reader_config)
  
file_path: DeepPavlov/deeppavlov/core/commands/train.py
imports: from logging import getLogger
  from pathlib import Path
  from typing import Dict, Union, Optional, Iterable
  from deeppavlov.core.commands.utils import expand_path, import_packages, parse_config
  from deeppavlov.core.common.errors import ConfigError
  from deeppavlov.core.common.params import resolve
  from deeppavlov.core.common.registry import get_model
  from deeppavlov.core.data.data_fitting_iterator import DataFittingIterator
  from deeppavlov.core.data.data_learning_iterator import DataLearningIterator
  from deeppavlov.core.data.utils import get_all_elems_from_json
  from deeppavlov.download import deep_download
  from deeppavlov.utils.pip_wrapper import install_from_config
label_desc: Use image node_id 1 for calling a global function with example usage: read_data_by_config(config) and returns: reader