code: def link_file_load(src, dst, dry_run=False):
      """Just a little helper to hardlink files's load"""
      dst_dir = op.dirname(dst)
      if not op.exists(dst_dir):
          os.makedirs(dst_dir)
      if op.lexists(dst):
          lgr.log(
              9,
              "Destination file %(dst)s exists. Removing it first",
              locals(),
          )
          # TODO: how would it interact with git/git-annex
          unlink(dst)
      lgr.log(9, "Hardlinking %(src)s under %(dst)s", locals())
      src_realpath = op.realpath(src)
  
      try:
          os.link(src_realpath, dst)
      except (OSError, AttributeError) as e:
          # we need to catch OSError too, because Python's own logic
          # of not providing link() where it is known to be unsupported
          # (e.g. Windows) will not cover scenarios where a particular
          # filesystem simply does not implement it on an otherwise
          # sane platform (e.g. exfat on Linux)
          lgr.warning("Linking of %s failed (%s), copying file", src, e)
          shutil.copyfile(src_realpath, dst)
          shutil.copystat(src_realpath, dst)
      else:
          lgr.log(2, "Hardlinking finished")
  
imports: import logging
  import os
  import os.path
  import shutil
  from operator import itemgetter
  from pathlib import Path
  from urllib.parse import urlparse
  from annexremote import UnsupportedRequest
  from datalad.consts import ARCHIVES_SPECIAL_REMOTE
  from datalad.customremotes import RemoteError
  from datalad.customremotes.main import main
  from datalad.distribution.dataset import Dataset
  from datalad.support.annexrepo import AnnexRepo
  from datalad.support.archives import ArchivesCache
  from datalad.support.cache import DictCache
  from datalad.support.exceptions import CapturedException
  from datalad.support.locking import lock_if_check_fails
  from datalad.support.network import URL
  from datalad.utils import ensure_bytes, get_dataset_root, getpwd, unique, unlink
  from .base import AnnexCustomRemote
label_desc: Use image node_id 1 for calling a global function with example usage: link_file_load(src, dst, dry_run) without return types