code: def _writepath(tarfile, src, dst, onerror, postprocess, dereference):
      def tar_writepath(src, dst):
          st = os.lstat(src)
          if (
              stat.S_ISREG(st.st_mode)
              or stat.S_ISDIR(st.st_mode)
              or stat.S_ISLNK(st.st_mode)
          ):
              if dereference and stat.S_ISLNK(st.st_mode):
                  src = os.path.realpath(src)
  
              tarfile.writepath(src, dst)
  
              if postprocess:
                  postprocess(src, dst, st.st_mode)
          else:
              logger.debug(
                  "Skipping non-regular file '%s' (stat: %s)", src, st
              )
  
      try:
          return tar_writepath(src, dst)
      except Exception as e:
          if isinstance(e, OSError) and e.errno == errno.ENOENT:
              logger.debug(
                  "Skipping missing file '%s' - looks like directory content has changed during archiving",
                  src,
              )
              return
  
          if onerror:
              if onerror(src, dst, sys.exc_info()):
                  return tar_writepath(src, dst)
          else:
              raise
  
imports: import errno
  import logging
  import os
  import random
  import shutil
  import stat
  import string
  import sys
  import six
  import libarchive
  import libarchive._libarchive
  from pathlib2 import PurePath
label_desc: Use image node_id 6 for calling a global function with example usage: _writepath(tarfile, src, dst, onerror, postprocess, dereference) and returns: tar_writepath, tar_writepath