code: def safe_join(directory: FilePath, *paths: FilePath) -> Path:
      
      try:
          safe_path = file_path_to_path(directory).resolve(strict=True)
          full_path = file_path_to_path(directory, *paths).resolve(strict=True)
      except FileNotFoundError:
          raise NotFound()
      try:
          full_path.relative_to(safe_path)
      except ValueError:
          raise NotFound()
      return full_path
docs: Safely join the paths to the known directory to return a full path.
  
      Raises:
          NotFound: if the full path does not share a commonprefix with
          the directory.