'Check if the target file should be deleted if it already exists.'

def delete_file(self, path, prefixed_path, source_storage):

    if self.storage.exists(prefixed_path):
        try:
            target_last_modified = self.storage.get_modified_time(prefixed_path)
        except (OSError, NotImplementedError, AttributeError):
            pass
        else:
            try:
                source_last_modified = source_storage.get_modified_time(path)
            except (OSError, NotImplementedError, AttributeError):
                pass
            else:
                if self.local:
                    full_path = self.storage.path(prefixed_path)
                    can_skip_unmodified_files = (not (self.symlink ^ os.path.islink(full_path)))
                else:
                    full_path = None
                    can_skip_unmodified_files = True
                file_is_unmodified = (target_last_modified.replace(microsecond=0) >= source_last_modified.replace(microsecond=0))
                if (file_is_unmodified and can_skip_unmodified_files):
                    if (prefixed_path not in self.unmodified_files):
                        self.unmodified_files.append(prefixed_path)
                    self.log(("Skipping    '%s'    (not    modified)" % path))
                    return False
        if self.dry_run:
            self.log(("Pretending    to    delete    '%s'" % path))
        else:
            self.log(("Deleting    '%s'" % path))
            self.storage.delete(prefixed_path)
    return True
