def _nodes(e):
from .basic import Basic<EOL>if isinstance(e, Basic):<EOL><INDENT>return e.count(Basic)<EOL><DEDENT>elif iterable(e):<EOL><INDENT>return <NUM_LIT:1> + sum(_nodes(ei) for ei in e)<EOL><DEDENT>elif isinstance(e, dict):<EOL><INDENT>return <NUM_LIT:1> + sum(_nodes(k) + _nodes(v) for k, v in e.items())<EOL><DEDENT>else:<EOL><INDENT>return <NUM_LIT:1><EOL><DEDENT>
A helper for ordered() which returns the node count of ``e`` which
for Basic objects is the number of Basic nodes in the expression tree
but for other objects is 1 (unless the object is an iterable or dict
for which the sum of nodes is returned).