'Returns True iff opening a sub-tag is valid in this context.'

def AcceptTag(self, tag):

    valid = (tag in self._allowed_tags)
    if valid:
        self._last_tag = tag
    else:
        self._last_tag = None
    return valid
