code: async def list_batches(self, request):
          
          paging_controls = self._get_paging_controls(request)
          validator_query = client_batch_pb2.ClientBatchListRequest(
              head_id=self._get_head_id(request),
              batch_ids=self._get_filter_ids(request),
              sorting=self._get_sorting_message(request, "default"),
              paging=self._make_paging_message(paging_controls))
  
          response = await self._query_validator(
              Message.CLIENT_BATCH_LIST_REQUEST,
              client_batch_pb2.ClientBatchListResponse,
              validator_query)
  
          return self._wrap_paginated_response(
              request=request,
              response=response,
              controls=paging_controls,
              data=[self._expand_batch(b) for b in response['batches']])
docs: Fetches list of batches from validator, optionally filtered by id.
  
          Request:
              query:
                  - head: The id of the block to use as the head of the chain
                  - id: Comma separated list of batch ids to include in results
  
          Response:
              data: JSON array of fully expanded Batch objects
              head: The head used for this query (most recent if unspecified)
              link: The link to this exact query, including head block
              paging: Paging info and nav, like total resources and a next link