def METHOD_NAME(self, name, path=None, target=None):
    spec = super().METHOD_NAME(name, path, target)
    if spec is not None and spec.loader is not None:
        old_loader = spec.loader
        class NoCacheLoader(type(old_loader)):  # type: ignore
            def __init__(wrapper) -> None:
                pass
            def set_data(wrapper, *args, **kwarg):
                # We don't want to generate __pycache__
                # directories in the checkpoint dir.
                raise NotImplementedError()
            def __getattr__(wrapper, *args, **kwargs):
                return getattr(old_loader, *args, **kwargs)
            def __setattr__(wrapper, *args, **kwargs):
                return setattr(old_loader, *args, **kwargs)
            def __delattr__(wrapper, *args, **kwargs):
                return delattr(old_loader, *args, **kwargs)
        spec.loader = NoCacheLoader()
    return spec