def METHOD_NAME(snippet):
  # Multiquery, if not first statement or arrived to the last query
  should_close = False
  handle = snippet['result'].get('handle', {})
  statement_id = handle.get('statement_id', 0)
  statements_count = handle.get('statements_count', 1)
  statements = get_statements(snippet['statement'], snippet['dialect'] if 'dialect' in snippet else None)
  statement_id = min(statement_id, len(statements) - 1) # In case of removal of statements
  previous_statement_hash = compute_statement_hash(statements[statement_id]['statement'])
  non_edited_statement = previous_statement_hash == handle.get('previous_statement_hash') or not handle.get('previous_statement_hash')
  if handle.get('has_more_statements'):
    should_close = True
    if non_edited_statement:
      statement_id += 1
  else:
    if non_edited_statement:
      statement_id = 0
  if statements_count != len(statements):
    statement_id = min(statement_id, len(statements) - 1)
  resp = {
    'statement_id': statement_id,
    'has_more_statements': statement_id < len(statements) - 1,
    'statements_count': len(statements),
    'previous_statement_hash': compute_statement_hash(statements[statement_id]['statement'])
  }
  resp.update(statements[statement_id])
  return should_close, resp