Close issue 12958 by flagging expected failures in test_socket on Mac OS X
diff --git a/Lib/test/support.py b/Lib/test/support.py
index 03af378..015564b 100644
--- a/Lib/test/support.py
+++ b/Lib/test/support.py
@@ -57,6 +57,7 @@
     "get_attribute", "swap_item", "swap_attr", "requires_IEEE_754",
     "TestHandler", "Matcher", "can_symlink", "skip_unless_symlink",
     "import_fresh_module", "requires_zlib", "PIPE_MAX_SIZE", "failfast",
+    "anticipate_failure"
     ]
 
 class Error(Exception):
@@ -127,6 +128,17 @@
     return saved
 
 
+def anticipate_failure(condition):
+    """Decorator to mark a test that is known to be broken in some cases
+
+       Any use of this decorator should have a comment identifying the
+       associated tracker issue.
+    """
+    if condition:
+        return unittest.expectedFailure
+    return lambda f: f
+
+
 def import_fresh_module(name, fresh=(), blocked=(), deprecated=False):
     """Imports and returns a module, deliberately bypassing the sys.modules cache
     and importing a fresh copy of the module. Once the import is complete,