def safe_copy(src, dst, overwrite=True):
  """Copy safely from src to dst by creating intermediate directories.

  Args:
    src: File to copy
    dst: Where to copy to
    overwrite: Whether to overwrite destination if it exists
  """
  if isinstance(src, pathlib.PurePath):
    src = str(src)

  dst = safe_path(dst)
  tf.io.gfile.copy(src, dst, overwrite=overwrite)
Copy safely from src to dst by creating intermediate directories.

  Args:
    src: File to copy
    dst: Where to copy to
    overwrite: Whether to overwrite destination if it exists
  
language/serene/util.py