code: def _get_data_source(test_path, data_config, field_names, task):
      if hasattr(data_config, "data_dict_config"):
          # it's multiple data
          if data_config.test_key:
              source_config = data_config.data_dict_config[
                  data_config.test_key
              ].source
          else:
              source_config = next(
                  iter(data_config.data_dict_config.values())
              ).source
      else:
          source_config = getattr(data_config, "source", None)
  
      if isinstance(task, NewDisjointMultitask):
          # Cannot easily specify a single data source for multitask
          assert not test_path
          data_source = None
      elif test_path and (
          hasattr(source_config, "test_filename")
          or hasattr(source_config, "test_path")
      ):
          if hasattr(source_config, "test_filename"):
              source_config.test_filename = test_path
          elif hasattr(source_config, "test_path"):
              source_config.test_path = test_path
  
          if field_names and hasattr(source_config, "field_names"):
              source_config.field_names = field_names
          data_source = create_component(
              ComponentType.DATA_SOURCE,
              source_config,
              task.data.data_source.schema,
          )
      else:
          data_source = task.data.data_source
      return data_source
  
imports: import gzip
  import json
  import os
  import sys
  import traceback
  from typing import Any, Dict, get_type_hints, IO, Iterator, List, Optional, Tuple, Union
  import torch
  from pytext.common.constants import Stage
  from pytext.config import ExportConfig, PyTextConfig, TestConfig
  from pytext.config.component import ComponentType, create_component, create_exporter
  from pytext.data.data import Batcher
  from pytext.data.data_handler import CommonMetadata
  from pytext.metric_reporters.channel import Channel
  from pytext.task import create_task, get_latest_checkpoint_path, load, NewTask, save, Task_Deprecated
  from pytext.task.disjoint_multitask import NewDisjointMultitask
  from pytext.trainers import TrainingState
  from pytext.utils import cuda, distributed, precision, round_seq, set_random_seeds, timing
  from pytext.utils.file_io import PathManager
label_desc: Use image node_id 13 for calling a global function with example usage: _get_data_source(test_path, data_config, field_names, task) and returns: data_source