def METHOD_NAME(func):
    """Decorator to prevent more than 1 instance of a module.
    This function can be used as a decorator to create lock files on python
    modules where we only want one instance running at any given time.
    More info at top of module
    Parameters
    ----------
    func : func
        The function to decorate.
    Returns
    -------
    wrapped : func
        The wrapped function.
    """
    @wraps(func)
    def wrapped(*args, **kwargs):
        # Get the module name of the calling method
        existing_lock = False
        notify_str = ""
        frame = inspect.stack()[1]
        mod = inspect.getmodule(frame[0])
        module = mod.__file__
        # remove python suffix if it exists, then append to make testing work properly for instances where .py may not exist
        module_lock = module.replace('.py', '.lock')
        if os.path.exists(module_lock):
            notify_str, existing_lock = _clean_lock_file(module_lock, module)
        if not existing_lock:
            if notify_str:
                _send_notification(notify_str)
                notify_str = ""
            try:
                with open(module_lock, "w") as lock_file:
                    lock_file.write(f"{_PID_LOCKFILE_KEY}{os.getpid()}\n")
                return func(*args, **kwargs)
            finally:
                try:
                    os.remove(module_lock)
                except Exception as e:
                    notify_str = f"Exception {e} \n {type(e).__name__}\n{e.args}\n"
                    notify_str = notify_str + module_lock + " delete failed, please investigate cause"
        if len(notify_str):
            _send_notification(notify_str)
    return wrapped