'Given a section and a depth level, walk back through the sections
parents to see if the depth level matches a previous section.
Return a reference to the right section,
or raise a SyntaxError.'

def _match_depth(self, sect, depth):

    while (depth < sect.depth):
        if (sect is sect.parent):
            raise SyntaxError()
        sect = sect.parent
    if (sect.depth == depth):
        return sect
    raise SyntaxError()
