Get the comments collapsed for given user on given recid page

def get_user_collapsed_comments_for_record(uid, recid):
    """
    Get the comments collapsed for given user on given recid page
    """
    # Collapsed state is not an attribute of cmtRECORDCOMMENT table
    # (vary per user) so it cannot be found when querying for the
    # comment. We must therefore provide a efficient way to retrieve
    # the collapsed state for a given discussion page and user.
    query = """SELECT "id_cmtRECORDCOMMENT" from "cmtCOLLAPSED" WHERE id_user=%s and id_bibrec=%s"""
    params = (uid, recid)
    return [res[0] for res in run_sql(query, params)]