def _asciiArt(self, char1='<STR_LIT:->', show_internal=True, compact=False, attributes=None):
if not attributes:<EOL><INDENT>attributes = ["<STR_LIT:name>"]<EOL><DEDENT>_attrlist = [getattr(self, v) for v in attributes if hasattr(self, v)]<EOL>node_name = "<STR_LIT:U+002CU+0020>".join([str(i) for i in _attrlist])<EOL>LEN = max(<NUM_LIT:3>, len(node_name) if not self.children or show_internal else <NUM_LIT:3>)<EOL>PAD = '<STR_LIT:U+0020>' * LEN<EOL>PA = '<STR_LIT:U+0020>' * (LEN-<NUM_LIT:1>)<EOL>if not self.is_leaf():<EOL><INDENT>mids = []<EOL>result = []<EOL>for c in self.children:<EOL><INDENT>if len(self.children) == <NUM_LIT:1>:<EOL><INDENT>char2 = '<STR_LIT:/>'<EOL><DEDENT>elif c is self.children[<NUM_LIT:0>]:<EOL><INDENT>char2 = '<STR_LIT:/>'<EOL><DEDENT>elif c is self.children[-<NUM_LIT:1>]:<EOL><INDENT>char2 = '<STR_LIT:\\>'<EOL><DEDENT>else:<EOL><INDENT>char2 = '<STR_LIT:->'<EOL><DEDENT>(clines, mid) = c._asciiArt(char2, show_internal, compact, attributes)<EOL>mids.append(mid+len(result))<EOL>result.extend(clines)<EOL>if not compact:<EOL><INDENT>result.append('<STR_LIT>')<EOL><DEDENT><DEDENT>if not compact:<EOL><INDENT>result.pop()<EOL><DEDENT>(lo, hi, end) = (mids[<NUM_LIT:0>], mids[-<NUM_LIT:1>], len(result))<EOL>prefixes = [PAD] * (lo+<NUM_LIT:1>) + [PA+'<STR_LIT:|>'] * (hi-lo-<NUM_LIT:1>) + [PAD] * (end-hi)<EOL>mid = int((lo + hi) / <NUM_LIT:2>)<EOL>prefixes[mid] = char1 + '<STR_LIT:->'*(LEN-<NUM_LIT:2>) + prefixes[mid][-<NUM_LIT:1>]<EOL>result = [p+l for (p,l) in zip(prefixes, result)]<EOL>if show_internal:<EOL><INDENT>stem = result[mid]<EOL>result[mid] = stem[<NUM_LIT:0>] + node_name + stem[len(node_name)+<NUM_LIT:1>:]<EOL><DEDENT>return (result, mid)<EOL><DEDENT>else:<EOL><INDENT>return ([char1 + '<STR_LIT:->' + node_name], <NUM_LIT:0>)<EOL><DEDENT>
Returns the ASCII representation of the tree.
Code based on the PyCogent GPL project.