'Clears the response output stream and sets the given HTTP error code.
Args:
code: the HTTP status error code (e.g., 501)'

def error(self, code):

    self.response.set_status(code)
    self.response.clear()
