substitute the result for starttag_re. call the function re.compile with an argument string '</%s>' formated with tags_re, substitute the result for endtag_re.
endtag_re = re . compile ( '</%s>' % tags_re )