def _thread_safe(fn):
    """Decorator that expects a class method which has a _lock attribute.

    Args:
        fn: Method to be wrapped.

    Returns:
        method: The wrapper method
    """

    def wrapper(*args, **kwargs):
        self = args[0]

        with self._lock:
            return_value = fn(*args, **kwargs)

        return return_value

    return wrapper