def check_if_database_is_slave(db_connection):
    """Returns True if the queried database is a slave node,
    i.e. is in recovery mode streaming data from master.
    """
    with db_connection.cursor() as c:
        c.execute("SELECT pg_is_in_recovery()")
        result = c.fetchone()
        return bool(result) and result[0]