move assertins about flags variable nature from folder/IMAP.py to imaputil.py