def get_definition(self, name: YangIdentifier,
                       kw: YangIdentifier) -> Optional["Statement"]:
        """Search ancestor statements for a definition.

        Args:
            name: Name of a grouping or datatype (with no prefix).
            kw: ``grouping`` or ``typedef``.

        Raises:
            DefinitionNotFound: If the definition is not found.
        """
        stmt = self.superstmt
        while stmt:
            res = stmt.find1(kw, name)
            if res:
                return res
            stmt = stmt.superstmt
        return None