'Handle a POST request from the client and sends response back.'

def do_POST(self):

    if (('grade' in self.path) and (self._send_graded_result().status_code == 200)):
        status_message = ('LTI    consumer    (edX)    responded    with    XML    content:<br>' + self.server.grade_data['TC    answer'])
        content = self._create_content(status_message)
        self.send_response(200, content)
    elif (('lti2_outcome' in self.path) and (self._send_lti2_outcome().status_code == 200)):
        status_message = 'LTI    consumer    (edX)    responded    with    HTTP    {}<br>'.format(self.server.grade_data['status_code'])
        content = self._create_content(status_message)
        self.send_response(200, content)
    elif (('lti2_delete' in self.path) and (self._send_lti2_delete().status_code == 200)):
        status_message = 'LTI    consumer    (edX)    responded    with    HTTP    {}<br>'.format(self.server.grade_data['status_code'])
        content = self._create_content(status_message)
        self.send_response(200, content)
    elif self._is_correct_lti_request():
        params = {k: v for (k, v) in self.post_dict.items() if (k != 'oauth_signature')}
        if self._check_oauth_signature(params, self.post_dict.get('oauth_signature', '')):
            status_message = 'This    is    LTI    tool.    Success.'
            if ('lis_outcome_service_url' in self.post_dict):
                self.server.grade_data = {'callback_url': self.post_dict.get('lis_outcome_service_url').replace('https', 'http'), 'sourcedId': self.post_dict.get('lis_result_sourcedid')}
            submit_url = '//{}:{}'.format(*self.server.server_address)
            content = self._create_content(status_message, submit_url)
            self.send_response(200, content)
        else:
            content = self._create_content('Wrong    LTI    signature')
            self.send_response(200, content)
    else:
        content = self._create_content('Invalid    request    URL')
        self.send_response(500, content)
