def check_as_closer(self, node, active_node):
        """
        Originally this was slated to be removed because it only provided security against bugs we hadn't tested against.
        In practice (the last 4 years), it proved to be invaluable in
        providing better error messages than otherwise would be available.

        It didn't uncover any real bugs, but it showed incorrect indentation at a better level than would otherwise be provided.

        Technically removing this wouldn't result in invalid code immediately,
        but it'll let you write poorly Nemo and forget about it.
        Then later on, you'll end up writing more seemingly valid code which will
        caused an error in previously written statements.

        Unlike in HAML, we've chosen to cause an error as soon as possible,
        rather than implicitly swallowing the error node.
        """

        # Debugging
        #print node
        #print self
        # The node passed in should be a MakoNode or a MakoLeaf at the same indentation level

        # Who is closing?
        if self is active_node:
            # I am the active node, so I am the unambiguous choice to be closed at this time
            return      

        potentially_closed = active_node.parent
        while potentially_closed is not None:

            #print 'Checking: %s' % potentially_closed
            if potentially_closed.depth == node.depth:
                # <potentially_closed> is definitely being closed by <node>, and all is well
                # Todo: Perform type checking to make sure MakoNodes only close against other MakoNodes
                return
            elif potentially_closed.depth < node.depth:
                # How am is <node> closing someone at a lower depth than it?
                raise NemoException('\nIncorrect indentation\n' + \
                                    'at:\n\t%s\n' % node + \
                                    'Tried to close against::\n\t%s\n' % self + \
                                    'Within active scope of:\n\t%s' % active_node )

            potentially_closed = potentially_closed.parent
dataset/ETHPy150Open KaySackey/Nemo/nemo/nodes.py/MakoNode.check_as_closer/original