code: def add_writable_directory_volume(self,
                                        runtime,          # type: List[Text]
                                        volume,           # type: MapperEnt
                                        host_outdir_tgt,  # type: Optional[Text]
                                        tmpdir_prefix     # type: Text
                                       ):  # type: (...) -> None
          
          if volume.resolved.startswith("_:"):
              # Synthetic directory that needs creating first
              if not host_outdir_tgt:
                  tmp_dir, tmp_prefix = os.path.split(tmpdir_prefix)
                  new_dir = os.path.join(
                      tempfile.mkdtemp(prefix=tmp_prefix, dir=tmp_dir),
                      os.path.basename(volume.target))
                  self.append_volume(runtime, new_dir, volume.target,
                                     writable=True)
              elif not os.path.exists(host_outdir_tgt):
                  os.makedirs(host_outdir_tgt)
          else:
              if self.inplace_update:
                  self.append_volume(runtime, volume.resolved, volume.target,
                                     writable=True)
              else:
                  if not host_outdir_tgt:
                      tmp_dir, tmp_prefix = os.path.split(tmpdir_prefix)
                      tmpdir = tempfile.mkdtemp(prefix=tmp_prefix, dir=tmp_dir)
                      new_dir = os.path.join(
                          tmpdir, os.path.basename(volume.resolved))
                      shutil.copytree(volume.resolved, new_dir)
                      self.append_volume(
                          runtime, new_dir, volume.target,
                          writable=True)
                  else:
                      shutil.copytree(volume.resolved, host_outdir_tgt)
                  ensure_writable(host_outdir_tgt or new_dir)
docs: Append a writable directory mapping to the runtime option list.