code: def _list(self, foldername="INBOX", reverse=False, since=None):
          folder = self.folder \
              if foldername == "INBOX" \
              else self._getfolder(foldername)
          def sortcmp(d):
              try:
                  return d[1].date
              except:
                  return -1
          lst = folder.items() if not since else folder.items_since(since)
          sorted_lst = sorted(lst, key=sortcmp, reverse=1 if reverse else 0)
          itemlist = [(folder, key, msg) for key,msg in sorted_lst]
          return itemlist