! Decorator to automatically lock an AccessPort method.

def _locked(func):
    """! Decorator to automatically lock an AccessPort method."""
    def _locking(self, *args, **kwargs):
        try:
            self.lock()
            return func(self, *args, **kwargs)
        finally:
            self.unlock()
    return _locking