Generates a list of values of the `attribute` of all ancestors of
            the given `node` (as well as the node itself). If a value is
            ``None``, then the optional value of `missing` is used (by default
            ``None``).

            By default, the ``getattr(node, attribute, None) or missing``
            mechanism is used to obtain the value of the attribute for each
            node. This can be overridden by supplying a custom `visitor`
            function, which expects as arguments the node and the attribute, and
            should return an appropriate value for the required attribute.

            :param node: the :class:`CTENode` for which to generate the
                attribute path.

            :param attribute: the name of the attribute.

            :param missing: optional value to use when attribute value is None.

            :param visitor: optional function responsible for obtaining the
                attribute value from a node.

            :return: a list of values of the required `attribute` of the
                ancestor path of the given `node`.

def attribute_path(
        self,
        node,
        attribute,
        missing=None,
        visitor=lambda node, attribute: getattr(node, attribute, None),
    ):
        """ Generates a list of values of the `attribute` of all ancestors of
            the given `node` (as well as the node itself). If a value is
            ``None``, then the optional value of `missing` is used (by default
            ``None``).

            By default, the ``getattr(node, attribute, None) or missing``
            mechanism is used to obtain the value of the attribute for each
            node. This can be overridden by supplying a custom `visitor`
            function, which expects as arguments the node and the attribute, and
            should return an appropriate value for the required attribute.

            :param node: the :class:`CTENode` for which to generate the
                attribute path.

            :param attribute: the name of the attribute.

            :param missing: optional value to use when attribute value is None.

            :param visitor: optional function responsible for obtaining the
                attribute value from a node.

            :return: a list of values of the required `attribute` of the
                ancestor path of the given `node`.
        """
        return [visitor(c, attribute) or missing for c in node.ancestors()] + [
            visitor(node, attribute) or missing
        ]