def set_status(self, code=None, text=None):
        """
        @type code: int
        @type text: str
        """
        if code:
            if code < 100 or code > 599:
                raise Exception('Invalid status code: %i' % code)
            self._status_code = code
        self._status_text = text if text else self.REASON_PHRASES[code] if code in self.REASON_PHRASES else ''
        return self
def set_status ( self , code = None , text = None ) : if code : if code < 100 or code > 599 : raise Exception ( 'Invalid status code: %i' % code ) self . _status_code = code self . _status_text = text if text else self . REASON_PHRASES [ code ] if code in self . REASON_PHRASES else '' return self
@type code: int
        @type text: str