Construct a KeySet protobuf.

        :rtype: :class:`~google.cloud.spanner_v1.proto.keys_pb2.KeySet`
        :returns: protobuf corresponding to this instance.

def _to_pb(self):
        """Construct a KeySet protobuf.

        :rtype: :class:`~google.cloud.spanner_v1.proto.keys_pb2.KeySet`
        :returns: protobuf corresponding to this instance.
        """
        if self.all_:
            return KeySetPB(all=True)
        kwargs = {}

        if self.keys:
            kwargs["keys"] = _make_list_value_pbs(self.keys)

        if self.ranges:
            kwargs["ranges"] = [krange._to_pb() for krange in self.ranges]

        return KeySetPB(**kwargs)