code: def _to_dict(self):
          
          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
docs: Return keyrange's state as a dict.
  
          :rtype: dict
          :returns: state of this instance.