<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def from_stored(self, key):
 """ Set the current collection as based on a stored one. The key argument is the key off the stored collection. """

        # only one stored key allowed
        if self.stored_key:
            raise ValueError('This collection is already based on a stored one')

        # prepare the collection
        self.stored_key = key
        self.intersect(_StoredCollection(self.cls.get_connection(), key))
        self.sort(by='nosort')  # keep stored order

        # count the number of results to manage empty result (to not behave like
        # expired key)
        self._stored_len = self.cls.get_connection().llen(key)

        return self