human
Complete this python program:
def check_interaction(fn):
assistant
#Here is the Python program you requested.

    """Decorator to clean and prevent interaction when not available
    """
    def check_fn(self, *args, **kwargs):
        interact_lock.acquire()
        try:
            if self.filename:
                self.clear_interaction()
                return fn(self, *args, **kwargs)
        finally:
            interact_lock.release()
    return check_fn