def METHOD_NAME(cli):
   if (not os.path.exists(cli.path)):
      ch.FATAL("can’t copy: not found: %s" % cli.path)
   pathstr = im.Reference.ref_to_pathstr(cli.image_ref)
   if (cli.bucache == ch.Build_Mode.ENABLED):
      # Un-tag previously deleted branch, if it exists.
      bu.cache.tag_delete(pathstr, fail_ok=True)
   dst = im.Image(im.Reference(cli.image_ref))
   ch.INFO("importing:    %s" % cli.path)
   ch.INFO("destination:  %s" % dst)
   dst.unpack_clear()
   if (os.path.isdir(cli.path)):
      dst.copy_unpacked(cli.path)
   else:  # tarball, hopefully
      dst.unpack([cli.path])
   bu.cache.adopt(dst)
   if (dst.metadata["history"] == []):
      dst.metadata["history"].append({ "empty_layer": False,
                                       "command":     "ch-image import"})
   dst.metadata_save()
   ch.done_notify()