def get_cached(self):
def id_in_list(list, id):<EOL><INDENT>if id:<EOL><INDENT>if [i for i in list if i.id == id]:<EOL><INDENT>return True<EOL><DEDENT>else:<EOL><INDENT>raise PyPumpException("<STR_LIT>" % self._since)<EOL><DEDENT><DEDENT><DEDENT>tmp = []<EOL>if self._before is not None:<EOL><INDENT>if not id_in_list(self.feed._items, self._before):<EOL><INDENT>return tmp<EOL><DEDENT>if isinstance(self._before, six.string_types):<EOL><INDENT>found = False<EOL>for i in self.feed._items:<EOL><INDENT>if not found:<EOL><INDENT>if i.id == self._before:<EOL><INDENT>found = True<EOL><DEDENT>continue<EOL><DEDENT>else:<EOL><INDENT>tmp.append(i)<EOL><DEDENT><DEDENT>self._before = False<EOL><DEDENT>return tmp<EOL><DEDENT>if self._since is not None:<EOL><INDENT>if not id_in_list(self.feed._items, self._since):<EOL><INDENT>return tmp<EOL><DEDENT>if isinstance(self._since, six.string_types):<EOL><INDENT>found = False<EOL>for i in self.feed._items:<EOL><INDENT>if i.id == self._since:<EOL><INDENT>found = True<EOL>break<EOL><DEDENT>else:<EOL><INDENT>tmp.append(i)<EOL><DEDENT><DEDENT>self._since = False<EOL><DEDENT>return reversed(tmp)<EOL><DEDENT>if not hasattr(self, '<STR_LIT>'):<EOL><INDENT>self.usedcache = True  <EOL>if isinstance(self._offset, int):<EOL><INDENT>return self.feed._items[self._offset:]<EOL><DEDENT>return self.feed._items<EOL><DEDENT>else:<EOL><INDENT>return tmp<EOL><DEDENT>
Get items from feed cache while trying to emulate
        how API handles offset/since/before parameters