code: def _ReadAndLockNextRequestsToProcess(self, flow_keys, cursor):
      
  
      query = """
        SELECT client_id, flow_id, next_request_to_process
        FROM flows
        WHERE {conditions}
        FOR UPDATE
      """
      condition_template = "(client_id = %s AND flow_id = %s)"
      conditions = [condition_template] * len(flow_keys)
      query = query.format(conditions=" OR ".join(conditions))
      args = []
      for client_id, flow_id in flow_keys:
        args.append(db_utils.ClientIDToInt(client_id))
        args.append(db_utils.FlowIDToInt(flow_id))
  
      cursor.execute(query, args)
      next_requests = {}
      for client_id_int, flow_id_int, next_request in cursor.fetchall():
        flow_key = (db_utils.IntToClientID(client_id_int),
                    db_utils.IntToFlowID(flow_id_int))
        next_requests[flow_key] = next_request
      return next_requests
docs: Reads and locks the next_request_to_process for a number of flows.