<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def check_sentence():
 """Sole porcupine endpoint"""

    text = ''
    if request.method == 'POST':
        text = request.form['text']
        if not text:
            error = 'No input'
            flash_message = error
        else:
            fb = check(request.form['text'])
            correct = False
            if request.form.get('is_correct') and not fb.primary_error:
                correct = True
            elif not request.form.get('is_correct') and fb.primary_error:
                correct = True
            sub = Submission(text=text, correct=correct, primary_error=fb.primary_error,
                    specific_error=fb.specific_error)
            session.add(sub)
            session.commit()
            # TODO: remove the hack below
            if not fb.primary_error:
                fb.human_readable = "No errors were found."
            flash_message = fb.human_readable

        flash(flash_message)
    return render_template('check_sentence.html', text=text)