Issue #7092: Fix the DeprecationWarnings emitted by the standard library
when using the -3 flag.  Patch by Florent Xicluna.
diff --git a/Lib/mailbox.py b/Lib/mailbox.py
index 74359b7..4da5569 100755
--- a/Lib/mailbox.py
+++ b/Lib/mailbox.py
@@ -18,7 +18,6 @@
 import email
 import email.message
 import email.generator
-import rfc822
 import StringIO
 try:
     if sys.platform == 'os2emx':
@@ -28,6 +27,13 @@
 except ImportError:
     fcntl = None
 
+import warnings
+with warnings.catch_warnings():
+    if sys.py3kwarning:
+        warnings.filterwarnings("ignore", ".*rfc822 has been removed",
+                                DeprecationWarning)
+    import rfc822
+
 __all__ = [ 'Mailbox', 'Maildir', 'mbox', 'MH', 'Babyl', 'MMDF',
             'Message', 'MaildirMessage', 'mboxMessage', 'MHMessage',
             'BabylMessage', 'MMDFMessage', 'UnixMailbox',