docs: def ls(self, foldername="INBOX", reverse=False, since=None, grep=None, field=None, stream=sys.stdout):
          """Do standard text list of the folder to the stream.
  
          'foldername' is the folder to list.. INBOX by default.
  
          'since' allows the listing to be date filtered since that
          date. It should be a float, a time since epoch.
          
          'grep' allows text matching on the whole record
  
          'field' allows only 1 field to be output
          """
          if foldername == "":
              foldername = "INBOX"
  
          msg_list = self._list(foldername, reverse, since)
          for folder, mk, m in msg_list:
              try:
                  # I am very unsure about this defaulting of foldername
                  output_items = (
                      "%s%s%s" % (folder.folder or foldername or "INBOX", SEPERATOR, mk),
                      m.date,
                      m.get_from()[0:50] if m.get_from() else "", 
                      m.get_flags(),
                      re.sub("\n", "", m.get_subject() or "")
                      )
  
                  output_string = "% -20s % 20s % 50s  [%s]  %s" % output_items
                  if not grep or (grep and grep in output_string):
                      if field:
                          print(output_items[int(field)], file=stream)
                      else:
                          print(output_string, file=stream)
              except IOError as e:
                  if e.errno == errno.EPIPE:
                      # Broken pipe we can ignore
                      return
                  self.logger.exception("whoops!")
              except Exception as e:
                  self.logger.exception("whoops!")