def check_to_avoid_overwrite(thing_to_check):
    """Makes a decorator which makes sure 'thing_to_check' is None before running func."""

    def _decorator(func):
        def careful_func(*args, force_overwrite=False, **kwargs):
            if force_overwrite:
                func(*args, **kwargs)
            else:
                if getattr(args[0], thing_to_check) is not None:
                    print(
                        f"Did not run to avoid overwriting. Set force_overwrite=True to overwrite."
                    )
                    return None
                else:
                    func(*args, **kwargs)

        return careful_func

    return _decorator