def _get_segment(self) -> Segment:
        """
        Temporarily cache the segment on the condition object to reduce number of queries.
        """
        if not hasattr(self, "segment"):
            setattr(self, "segment", self.rule.get_segment())  # type: ignore[no-untyped-call]
        return self.segment  # type: ignore[no-any-return]

        Temporarily cache the segment on the condition object to reduce number of queries.
        
api/segments/models.py