def parse(self, rule: str):
        """Parses policy to tree.

        Translate a policy written in the policy language into a tree of
        Check objects.
        """

        # Empty rule means always accept
        if not rule:
            return checks.TrueCheck()

        for token, value in self._parse_tokenize(rule):
            self._shift(token, value)

        try:
            return self.result
        except ValueError:
            LOG.exception('Failed to understand rule %r', rule)
            # Fail closed
            return checks.FalseCheck()