"""
Very partial backport of the `http.HTTPStatus` enum from Python 3.5

This implements just enough of the interface for our purposes, it does not
attempt to be a full implementation.
"""
# Python 3.0 - 3.4
try:
    from http import client as status_module
    from http.server import BaseHTTPRequestHandler
    responses = BaseHTTPRequestHandler.responses
# Python 2.7
except ImportError:
    import httplib as status_module
    responses = status_module.responses


class HTTPStatusValue(int):

    phrase = None

    def __new__(cls, code, phrase):
        instance = int.__new__(cls, code)
        instance.phrase = phrase
        return instance


class HTTPStatusProxy(object):

    def __getattr__(self, status):
        code = getattr(status_module, status)
        phrase = responses[code]
        if isinstance(phrase, tuple):
            phrase = phrase[0]
        value = HTTPStatusValue(code, phrase)
        setattr(self, status, value)
        return value


HTTPStatus = HTTPStatusProxy()

@@ -186,287 +186,8 @@
 %22%22%22%0A
-# Python 3.0 - 3.4%0Atry:%0A    from http import client as status_module%0A    from http.server import BaseHTTPRequestHandler%0A    responses = BaseHTTPRequestHandler.responses%0A# Python 2.7%0Aexcept ImportError:%0A    import httplib as status_module%0A    responses = status_module.responses%0A%0A
 %0Acla
@@ -199,21 +199,16 @@
 TPStatus
-Value
 (int):%0A%0A
@@ -363,22 +363,16 @@
 tance%0A%0A%0A
-class 
 HTTPStat
@@ -377,340 +377,160 @@
 atus
-Proxy(object):%0A%0A    def __getattr__(self, status):%0A        code = getattr(status_module, status)%0A        phrase = responses%5Bcode%5D%0A        if isinstance(phrase, tuple):%0A            phrase = phrase%5B0%5D%0A        value = HTTPStatusValue(code, phrase)%0A        setattr(self, status, value)%0A        return value%0A%0A%0AHTTPStatus = HTTPStatusProxy(
+.OK = HTTPStatus(200, 'OK')%0AHTTPStatus.NOT_MODIFIED = HTTPStatus(304, 'Not Modified')%0AHTTPStatus.METHOD_NOT_ALLOWED = HTTPStatus(405, 'Method Not Allowed'
 )%0A

Simplify HTTPStatus backport