code: def lock_rows(
      query: Query, session: Session
  ) -> Generator[None, None, None]:
      """Lock database rows during the context manager block.
  
      This is a convenient method for ``with_row_locks`` when we don't need the
      locked rows.
  
      :meta private:
      """
      locked_rows = with_row_locks(query, session)
      yield
      del locked_rows
  
imports: from __future__ import annotations
  import contextlib
  import copy
  import datetime
  import json
  import logging
  from typing import TYPE_CHECKING, Any, Generator, Iterable, overload
  from dateutil import relativedelta
  from sqlalchemy import TIMESTAMP, PickleType, event, nullsfirst, tuple_
  from sqlalchemy.dialects import mysql
  from sqlalchemy.types import JSON, Text, TypeDecorator
  from airflow.configuration import conf
  from airflow.serialization.enums import Encoding
  from airflow.utils.timezone import make_naive, utc
label_desc: Use image node_id 7 for calling a global function with example usage: lock_rows(query, session) without return types