def sort_by_term(self, order=None):
if order is None:<EOL><INDENT>self.terms = sorted(self.terms, key=lambda e: e.join_lc)<EOL><DEDENT>else:<EOL><INDENT>all_terms = list(self.terms)<EOL>sorted_terms = []<EOL>for tn in order:<EOL><INDENT>for t in list(all_terms):<EOL><INDENT>if t.term_is(tn):<EOL><INDENT>all_terms.remove(t)<EOL>sorted_terms.append(t)<EOL><DEDENT><DEDENT><DEDENT>sorted_terms.extend(sorted(all_terms, key=lambda e: e.join_lc))<EOL>self.terms = sorted_terms<EOL><DEDENT>
Sort the terms in the section.
:param order: If specified, a list of qualified, lowercased term names. These names will appear
first in the section, and the remaining terms will be sorted alphabetically. If not specified, all terms are
alphabetized.
:return: