code: def offsets_to_where_statement(start_batch_id, end_batch_id):
      if start_batch_id is None and end_batch_id is None:
          where_cond = ""
          query_args = None
          return (where_cond, query_args)
  
      assert start_batch_id != end_batch_id, start_batch_id
      if start_batch_id is None:
          assert end_batch_id
          where_cond = "WHERE batches.id < %s"
          query_args = (end_batch_id,)
      elif end_batch_id is None:
          assert start_batch_id
          where_cond = "WHERE batches.id >= %s"
          query_args = (start_batch_id,)
      else:
          where_cond = "WHERE batches.id >= %s AND batches.id < %s"
          query_args = (start_batch_id, end_batch_id)
  
      return (where_cond, query_args)
  
file_path: hail/batch/sql/populate_batch_updates.py
imports: import asyncio
  import functools
  import os
  import random
  import time
  from typing import List, Optional, Tuple
  from gear import Database, transaction
  from hailtop.utils import bounded_gather
label_desc: Use image node_id 1 for calling a global function with example usage: offsets_to_where_statement(start_batch_id, end_batch_id) and returns: where_cond,  query_args, where_cond,  query_args