def parents(self, term, recursive=False, **kwargs):
def dfs(term, recursive=False, visited={}, **kwargs):<EOL><INDENT>if term in visited: <EOL><INDENT>return []<EOL><DEDENT>visited[term], a = True, []<EOL>if dict.__contains__(self, term):<EOL><INDENT>a = self[term][<NUM_LIT:0>].keys()<EOL><DEDENT>for classifier in self.classifiers:<EOL><INDENT>a.extend(classifier.parents(term, **kwargs) or [])<EOL><DEDENT>if recursive:<EOL><INDENT>for w in a: a += dfs(w, recursive, visited, **kwargs)<EOL><DEDENT>return a<EOL><DEDENT>return unique(dfs(self._normalize(term), recursive, {}, **kwargs))<EOL>
Returns a list of all semantic types for the given term.
            If recursive=True, traverses parents up to the root.