title: python imaplib - mark email as unread or unseen
body: <p>Searching here and on the internet, there are a lot of examples to how to mark a message as SEEN, even though this is automatic with imap.</p>
  
  <p>But how can I mark an email as <code>UNSEEN</code> or <code>UNREAD</code>.</p>
  
  <p>I have a script in python which receives <code>UNSEEN</code> messages, and it works great. But after reading them, imap automatically marks them as <code>SEEN</code> which works fine but only if the script has no errors, because if it raises an exception, I want the email to be marked again as <code>UNSEEN</code>, so next time the script will read that message again.</p>
  
  <p>How can I achieved this?</p>
  
  <p>I have also used <code>mail.select(mail_label,readonly=True)</code>, but it doesn't help because with that I cannot mark a message as <code>SEEN</code> which I also need. I also want this to work with Gmail.</p>