<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def rename_table(conn, old_table_name, new_table_name, schema=None):
 """ Renames given table in activity table. You should remember to call this function whenever you rename a versioned table. :: from alembic import op from postgresql_audit import rename_table def upgrade():
 op.rename_table('article', 'article_v2') rename_table(op, 'article', 'article_v2') :param conn: An object that is able to execute SQL (either SQLAlchemy Connection, Engine or Alembic Operations object) :param old_table_name: The name of table to rename :param new_table_name: New name of the renamed table :param schema: Optional name of schema to use. """

    activity_table = get_activity_table(schema=schema)
    query = (
        activity_table
        .update()
        .values(table_name=new_table_name)
        .where(activity_table.c.table_name == old_table_name)
    )
    return conn.execute(query)