'Returns a googledatastore.Filter.
Args:
adapter: A datastore_rpc.AbstractAdapter'

def _to_pb_v1(self, adapter):

    if (not self._filters):
        return None
    if (len(self._filters) == 1):
        return self._filters[0]._to_pb_v1(adapter)
    pb = googledatastore.Filter()
    comp_pb = pb.composite_filter
    if (self.op == self.AND):
        comp_pb.op = googledatastore.CompositeFilter.AND
    else:
        raise datastore_errors.BadArgumentError('Datastore    V4    only    supports    CompositeFilter    with    AND    operator.')
    for f in self._filters:
        comp_pb.filters.add().CopyFrom(f._to_pb_v1(adapter))
    return pb
