code: def hardlink_or_copy(src, dst):
      ensure_dir(os.path.dirname(dst))
  
      if os.name == "nt":
          shutil.copy(src, dst)
      else:
          try:
              os.link(src, dst)
          except OSError as e:
              if e.errno == errno.EEXIST:
                  return
              elif e.errno in (
                  errno.EXDEV,
                  errno.EMLINK,
                  errno.EINVAL,
                  errno.EACCES,
              ):
                  sys.stderr.write(
                      "Can't make hardlink (errno={}) - fallback to copy: {} -> {}\n".format(
                          e.errno, src, dst
                      )
                  )
                  shutil.copy(src, dst)
              else:
                  sys.stderr.write("src: {} dst: {}\n".format(src, dst))
                  raise
  
imports: import datetime
  import errno
  import hashlib
  import json
  import logging
  import os
  import platform
  import random
  import shutil
  import socket
  import string
  import sys
  import tarfile
  import urllib2
  import retry
label_desc: Use image node_id 4 for calling a global function with example usage: hardlink_or_copy(src, dst) without return types