Set key to a copy of items and return the list that was previously
        stored if the key was set. If not key was set, returns an empty list.

def swap(self, key, items):
        """Set key to a copy of items and return the list that was previously
        stored if the key was set. If not key was set, returns an empty list.
        """
        if not isinstance(items, list):
            raise ValueError("items must be a list")
        return_value = []
        with self._lock:
            if key in self._dict:
                return_value = self._dict[key]
            # Make a copy since we don't want users keeping a reference that is
            # outside the lock
            self._dict[key] = items.copy()
        return return_value