def pformat_ast(node,
                include_attributes=INCLUDE_ATTRIBUTES_DEFAULT,
                indent=INDENT_DEFAULT):
    """
    Pretty-format an AST tree element

    Parameters
    ----------
    node : ast.AST
       Top-level node to render.
    include_attributes : bool, optional
        Whether to include node attributes.  Default False.
    indent : str, optional.
        Indentation string for nested expressions.  Default is two spaces.
    """
    def _fmt(node, prefix, level):

        def with_indent(*strs):
            return ''.join(((indent * level,) + strs))

        with_prefix = partial(with_indent, prefix)

        if isinstance(node, Name):
            # Special Case:
            # Render Name nodes on a single line.
            yield with_prefix(
                type(node).__name__,
                '(id=',
                repr(node.id),
                ', ctx=',
                type(node.ctx).__name__,
                '()),',
            )

        elif isinstance(node, Num):
            # Special Case:
            # Render Num nodes on a single line without names.
            yield with_prefix(
                type(node).__name__,
                '(%r),' % node.n,
            )

        elif isinstance(node, AST):
            fields_attrs = list(
                chain(
                    iter_fields(node),
                    iter_attributes(node) if include_attributes else (),
                )
            )
            if not fields_attrs:
                # Special Case:
                # Render the whole expression on one line if there are no
                # attributes.
                yield with_prefix(type(node).__name__, '(),')
                return

            yield with_prefix(type(node).__name__, '(')
            for name, value in fields_attrs:
                yield from _fmt(value, name + '=', level + 1)
            # Put a trailing comma if we're not at the top level.
            yield with_indent(')', ',' if level > 0 else '')

        elif isinstance(node, list):
            if not node:
                # Special Case:
                # Render empty lists on one line.
                yield with_prefix('[],')
                return

            yield with_prefix('[')
            yield from chain.from_iterable(
                map(partial(_fmt, prefix='', level=level + 1), node)
            )
            yield with_indent('],')
        else:
            yield with_prefix(repr(node), ',')

    return '\n'.join(_fmt(node, prefix='', level=0))
Pretty-format an AST tree element

    Parameters
    ----------
    node : ast.AST
       Top-level node to render.
    include_attributes : bool, optional
        Whether to include node attributes.  Default False.
    indent : str, optional.
        Indentation string for nested expressions.  Default is two spaces.