'Returns a googledatastore.Filter representation of the filter.
Args:
adapter: A datastore_rpc.AbstractAdapter.'

def _to_pb_v1(self, adapter):

    filter_pb = googledatastore.Filter()
    composite_filter = filter_pb.composite_filter
    composite_filter.op = googledatastore.CompositeFilter.AND
    if self._start:
        if self._start_incl:
            op = googledatastore.PropertyFilter.GREATER_THAN_OR_EQUAL
        else:
            op = googledatastore.PropertyFilter.GREATER_THAN
        pb = composite_filter.filters.add().property_filter
        pb.op = op
        pb.property.name = self._start.name()
        adapter.get_entity_converter().v3_property_to_v1_value(self._start, True, pb.value)
    if self._end:
        if self._end_incl:
            op = googledatastore.PropertyFilter.LESS_THAN_OR_EQUAL
        else:
            op = googledatastore.PropertyFilter.LESS_THAN
        pb = composite_filter.filters.add().property_filter
        pb.op = op
        pb.property.name = self._end.name()
        adapter.get_entity_converter().v3_property_to_v1_value(self._end, True, pb.value)
    return filter_pb
