@username_required<EOL>def delete_thread(thread_uid):
thread = storage.get_thread(thread_uid)<EOL>if not thread:<EOL><INDENT>abort(<NUM_LIT>)<EOL><DEDENT>if thread['<STR_LIT>'] != g.username:<EOL><INDENT>abort(<NUM_LIT>)<EOL><DEDENT>if request.method == '<STR_LIT:GET>':<EOL><INDENT>return render_template('<STR_LIT>',<EOL>thread=thread,<EOL>thread_uid=thread_uid)<EOL><DEDENT>if request.form.get('<STR_LIT>') != '<STR_LIT>':<EOL><INDENT>return error('<STR_LIT>')<EOL><DEDENT>storage.delete_thread(thread_uid)<EOL>flash('<STR_LIT>'.format(thread['<STR_LIT>']),<EOL>'<STR_LIT:success>')<EOL>return to_threads()<EOL>
Delete given thread and all its comments.

    :param thread_uid: Thread unique ID.