def _to_dict(self):
        """Return keyrange's state as a dict.

        :rtype: dict
        :returns: state of this instance.
        """
        mapping = {}

        if self.start_open:
            mapping["start_open"] = self.start_open

        if self.start_closed:
            mapping["start_closed"] = self.start_closed

        if self.end_open:
            mapping["end_open"] = self.end_open

        if self.end_closed:
            mapping["end_closed"] = self.end_closed

        return mapping
Return keyrange's state as a dict.

        :rtype: dict
        :returns: state of this instance.