<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def exclusively(f):
 """ Decorate a function to make it thread-safe by serializing invocations using a per-instance lock. """

    @wraps(f)
    def exclusively_f(self, *a, **kw):
        with self._lock:
            return f(self, *a, **kw)
    return exclusively_f