docs: def save_batches(server_context, assay_id, batches):
      # type: (ServerContext, int, List[Batch]) -> Union[List[Batch], None]
      """
      Saves a modified batches.
      :param server_context: A LabKey server context. See utils.create_server_context.
      :param assay_id: The assay protocol id.
      :param batches: The Batch(es) to save.
      :return:
      """
      save_batch_url = server_context.build_url('assay', 'saveAssayBatch.api')
      json_batches = []
  
      if batches is None:
          return None  # Nothing to save
  
      for batch in batches:
          if isinstance(batch, Batch):
              json_batches.append(batch.to_json())
          else:
              raise Exception('save_batch() "batches" expected to be a set Batch instances')
  
      payload = {
          'assayId': assay_id,
          'batches': json_batches
      }
      headers = {
          'Content-type': 'application/json',
          'Accept': 'text/plain'
      }
  
      json_body = server_context.make_request(save_batch_url, json_dumps(payload, sort_keys=True), headers=headers)
      if json_body is not None:
          resp_batches = json_body['batches']
          return [Batch.from_data(resp_batch) for resp_batch in resp_batches]
  
      return None