docs: def valid_status(*valid):
    """Decorator to assert that we're in a valid state."""
    def decorator(func):
      @functools.wraps(func)
      def _valid_status(self, *args, **kwargs):
        if self.status not in valid:
          raise protocol.ProtocolError(
              "`%s` called while in state: %s, valid: (%s)" % (
                  func.__name__, self.status, ",".join(map(str, valid))))
        return func(self, *args, **kwargs)
      return _valid_status
    return decorator