<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _collection(self):
 """ Effectively retrieve data according to lazy_collection. """

        old_sort_limits_and_len_mode = None if self._sort_limits is None else self._sort_limits.copy(), self._len_mode
        try:  # try block to always reset the _sort_limits in the "finally" part

            conn = self.cls.get_connection()
            self._len = 0

            # The collection fails (empty) if more than one pk or if the only one
            # doesn't exists
            try:
                pk = self._get_pk()
            except ValueError:
                return []
            else:
                if pk is not None and not self.cls.get_field('pk').exists(pk):
                    return []

            # Prepare options and final set to get/sort
            sort_options = self._prepare_sort_options(bool(pk))

            final_set, keys_to_delete = self._get_final_set(
                                                self._lazy_collection['sets'],
                                                pk, sort_options)

            if self._len_mode:
                if final_set is None:
                    if pk and not self._lazy_collection['sets']:
                        # we have a only pk
                        self._len = 1
                    else:
                        # we have nothing
                        self._len = 0
                else:
                    self._len = self._collection_length(final_set)
                    if keys_to_delete:
                        conn.delete(*keys_to_delete)

                # return nothing
                return

            else:

                # fill the collection
                if final_set is None:
                    if pk and not self._lazy_collection['sets']:
                        # we have a pk without other sets, and no
                        # needs to get values so we can simply return the pk
                        collection = {pk}
                    else:
                        # we have nothing
                        collection = {}
                else:
                    # compute the sets and call redis te retrieve wanted values
                    collection = self._final_redis_call(final_set, sort_options)
                    if keys_to_delete:
                        conn.delete(*keys_to_delete)

                # Format return values if needed
                return self._prepare_results(collection)
        finally:
            self._sort_limits, self._len_mode = old_sort_limits_and_len_mode