human
Complete this python program:
def lock_host(func, *args, **kwargs):
assistant
#Here is the Python program you requested.

    """A decorator that acquires a lock before accessing the debugger to
    avoid API locking related errors with the debugger host.
    """
    def inner(self, *args, **kwargs):
        self.host_lock.acquire()
        try:
            res = func(self, *args, **kwargs)
            self.host_lock.release()
        except Exception as e:
            self.host_lock.release()
            raise e
        return res
    return inner