code: def _resolve_definitions(
      fs: "FileSystem",
      targets: List[str],
      props: Dict[str, Any],
      config_path: "StrPath",
      definitions: "DictStrAny",
      onerror: Optional[Callable[[Any], Any]] = None,
  ):
      config_path = os.fspath(config_path)
      config_dir = fs.dirname(config_path)
      result: Dict[str, Dict] = {}
      for plot_id, plot_props in definitions.items():
          if plot_props is None:
              plot_props = {}
          if _id_is_path(plot_props):
              data_path = _normpath(fs.join(config_dir, plot_id))
              if _matches(targets, config_path, plot_id):
                  unpacked = unpack_if_dir(
                      fs,
                      data_path,
                      props={**plot_props, **props},
                      onerror=onerror,
                  )
                  dpath.merge(
                      result,
                      unpacked,
                  )
          elif _matches(targets, config_path, plot_id):
              adjusted_props = _adjust_sources(
                  fs, plot_props, config_dir
              )
              dpath.merge(
                  result,
                  {"data": {plot_id: {**adjusted_props, **props}}},
              )
  
      return result
  
imports: import csv
  import io
  import os
  from collections import defaultdict
  from copy import deepcopy
  from functools import partial
  from multiprocessing import cpu_count
  from typing import TYPE_CHECKING, Any, Callable, Dict, Iterator, List, Optional, Set, Union
  import dpath
  import dpath.options
  from funcy import first, ldistinct, project, reraise
  from dvc.exceptions import DvcException
  from dvc.log import logger
  from dvc.utils import error_handler, errored_revisions
  from dvc.utils.objects import cached_property
  from dvc.utils.serialize import PARSERS, EncodingError
  from dvc.utils.threadpool import ThreadPoolExecutor
  from dvc_render.image import ImageRenderer
label_desc: Use image node_id 14 for calling a global function with example usage: _resolve_definitions(fs, targets, props, config_path, definitions, onerror) and returns: result