code: def wait_for_batches(self, batch_ids, timeout=None):
          
          self._batch_tracker.watch_statuses(self, batch_ids)
          timeout = timeout or DEFAULT_TIMEOUT
          start_time = time()
  
          with self._wait_condition:
              while True:
                  if self._statuses is not None:
                      return _format_batch_statuses(
                          self._statuses, batch_ids, self._batch_tracker)
  
                  if time() - start_time > timeout:
                      statuses = self._batch_tracker.get_statuses(batch_ids)
                      return _format_batch_statuses(
                          statuses, batch_ids, self._batch_tracker)
  
                  self._wait_condition.wait(timeout - (time() - start_time))
docs: Locks until a list of batch ids is committed to the block chain
          or a timeout is exceeded. Returns the statuses of those batches.
  
          Args:
              batch_ids (list of str): The ids of the batches to wait for
              timeout(int): Maximum time in seconds to wait for
  
          Returns:
              list of BatchStatus: BatchStatuses to send back to client