def synchronized(wrapped):
    """ Synchronization decorator. """

    @functools.wraps(wrapped)
    def wrapper(*args, **kwargs):
        self = args[0]
        with self._lock:
            return wrapped(*args, **kwargs)

    return wrapper