'Send an immediate success/failure message
back to the client'

def _send_immediate_response(self, success, message=''):

    response_str = json.dumps({'return_code': (0 if success else 1), 'content': message})
    if self._is_grade_request():
        self.send_response(200, content=response_str, headers={'Content-type': 'text/plain'})
        self.log_message('XQueue:    sent    response    {0}'.format(response_str))
    else:
        self.send_response(500)
