import re # frequently used mailboxes less_re = re.compile('^(INBOX.*|Drafts|Templates|Sent|Sendt post)$') # mbox is INBOX showing up double on UW-imap servers... noise_re = re.compile('^(mbox|spam|Junk|Trash|broken(headers)?)$') def less( foldername ): return (less_re.search(foldername) and not noise_re.search(foldername)) def more( foldername ): return (not less_re.search(foldername) and not noise_re.search(foldername)) def most( foldername ): return (not noise_re.search(foldername))