code: def read_hdf(
      pattern,
      key,
      start=0,
      stop=None,
      columns=None,
      chunksize=1000000,
      sorted_index=False,
      lock=True,
      mode="r",
  ):
      """
      Read HDF files into a Dask DataFrame
  
      Read hdf files into a dask dataframe. This function is like
      ``pandas.read_hdf``, except it can read from a single large file, or from
      multiple files, or from multiple keys from the same file.
  
      Parameters
      ----------
      pattern : string, pathlib.Path, list
          File pattern (string), pathlib.Path, buffer to read from, or list of
          file paths. Can contain wildcards.
      key : group identifier in the store. Can contain wildcards
      start : optional, integer (defaults to 0), row number to start at
      stop : optional, integer (defaults to None, the last row), row number to
          stop at
      columns : list of columns, optional
          A list of columns that if not None, will limit the return
          columns (default is None)
      chunksize : positive integer, optional
          Maximal number of rows per partition (default is 1000000).
      sorted_index : boolean, optional
          Option to specify whether or not the input hdf files have a sorted
          index (default is False).
      lock : boolean, optional
          Option to use a lock to prevent concurrency issues (default is True).
      mode : {'a', 'r', 'r+'}, default 'r'. Mode to use when opening file(s).
          'r'
              Read-only; no data can be modified.
          'a'
              Append; an existing file is opened for reading and writing,
              and if the file does not exist it is created.
          'r+'
              It is similar to 'a', but the file must already exist.
  
      Returns
      -------
      dask.DataFrame
  
      Examples
      --------
      Load single file
  
      >>> dd.read_hdf('myfile.1.hdf5', '/x')  # doctest: +SKIP
  
      Load multiple files
  
      >>> dd.read_hdf('myfile.*.hdf5', '/x')  # doctest: +SKIP
  
      >>> dd.read_hdf(['myfile.1.hdf5', 'myfile.2.hdf5'], '/x')  # doctest: +SKIP
  
      Load multiple datasets
  
      >>> dd.read_hdf('myfile.1.hdf5', '/*')  # doctest: +SKIP
      """
      if lock is True:
          lock = get_scheduler_lock()
  
      key = key if key.startswith("/") else "/" + key
      # Convert path-like objects to a string
      pattern = stringify_path(pattern)
  
      if isinstance(pattern, str):
          paths = sorted(glob(pattern))
      else:
          paths = pattern
  
      if not isinstance(pattern, str) and len(paths) == 0:
          raise ValueError("No files provided")
      if not paths or len(paths) == 0:
          raise OSError(f"File(s) not found: {pattern}")
      for path in paths:
          try:
              exists = os.path.exists(path)
          except (ValueError, TypeError):
              exists = False
          if not exists:
              raise OSError(
                  f"File not found or insufficient permissions: {path}"
              )
      if (start != 0 or stop is not None) and len(paths) > 1:
          raise NotImplementedError(read_hdf_error_msg)
      if chunksize <= 0:
          raise ValueError("Chunksize must be a positive integer")
      if (start != 0 or stop is not None) and sorted_index:
          raise ValueError(
              "When assuming pre-partitioned data, data must be "
              "read in its entirety using the same chunksizes"
          )
  
      # Build metadata
      with pd.HDFStore(paths[0], mode=mode) as hdf:
          meta_key = _expand_key(key, hdf)[0]
          try:
              meta = pd.read_hdf(hdf, meta_key, stop=0)
          except IndexError:  # if file is empty, don't set stop
              meta = pd.read_hdf(hdf, meta_key)
      if columns is not None:
          meta = meta[columns]
  
      # Common kwargs
      if meta.ndim == 1:
          common_kwargs = {"name": meta.name, "mode": mode}
      else:
          common_kwargs = {"mode": mode}
  
      # Build parts
      parts, divisions = _build_parts(
          paths, key, start, stop, chunksize, sorted_index, mode
      )
  
      # Construct the output collection with from_map
      return from_map(
          HDFFunctionWrapper(columns, meta.ndim, lock, common_kwargs),
          parts,
          meta=meta,
          divisions=divisions,
          label="read-hdf",
          token=tokenize(
              paths, key, start, stop, sorted_index, chunksize, mode
          ),
          enforce_metadata=False,
      )
  
imports: from __future__ import annotations
  import os
  import uuid
  from fnmatch import fnmatch
  from glob import glob
  from warnings import warn
  import pandas
  from fsspec.utils import build_name_function, stringify_path
  from tlz import merge
  from dask import config
  from dask.base import compute_as_if_collection, get_scheduler, named_schedulers, tokenize
  from dask.dataframe.backends import dataframe_creation_dispatch
  from dask.dataframe.core import DataFrame, Scalar
  from dask.dataframe.io.io import _link, from_map
  from dask.dataframe.io.utils import DataFrameIOFunction, SupportsLock
  from dask.highlevelgraph import HighLevelGraph
  from dask.utils import get_scheduler_lock
  from dask.dataframe.core import _Frame
label_desc: Use image node_id 3 for calling a global function with example usage: read_hdf(pattern, key, start, stop, columns, chunksize, sorted_index, lock, mode) and returns: from_map