title: How to detect bounce emails
body: <p>How do you detect "bounceed" email replies and other automated responses for failed delivery attempts in Python?</p>
  
  <p>I'm implementing a simple server to relay messages between email and comments inside a custom web application. Because my comment model supports a "reply to all" feature, if two emails in a comment thread become invalid, there would possibly be an infinite email chain where my system would send out an email, get a bounceback email, relay this to the other invalid email, get a bounceback email, relay this back to the first, ad infinitum.</p>
  
  <p>I want to avoid this. Is there a standard error code used for bounced or rejected emails that I could check for, ideally with Python's <code>imaplib</code> package?</p>