Returns the list of ancestors of the given comment, ordered from
    oldest to newest ("top-down": direct parent of comID is at last position),
    up to given depth

    :param comID: the ID of the comment for which we want to retrieve ancestors
    :type comID: int
    :param depth: the maximum of levels up from the given comment we
                  want to retrieve ancestors. None for no limit, 1 for
                  direct parent only, etc.
    :type depth: int
    :return the list of ancestors
    :rtype: list

def get_comment_ancestors(comID, depth=None):
    """
    Returns the list of ancestors of the given comment, ordered from
    oldest to newest ("top-down": direct parent of comID is at last position),
    up to given depth

    :param comID: the ID of the comment for which we want to retrieve ancestors
    :type comID: int
    :param depth: the maximum of levels up from the given comment we
                  want to retrieve ancestors. None for no limit, 1 for
                  direct parent only, etc.
    :type depth: int
    :return the list of ancestors
    :rtype: list
    """
    if depth == 0:
        return []

    res = run_sql(
        """SELECT "in_reply_to_id_cmtRECORDCOMMENT" FROM "cmtRECORDCOMMENT" WHERE id=%s""",
        (comID,
         ))
    if res:
        parent_comID = res[0][0]
        if parent_comID == 0:
            return []
        parent_ancestors = []
        if depth:
            depth -= 1
        parent_ancestors = get_comment_ancestors(parent_comID, depth)
        parent_ancestors.append(parent_comID)
        return parent_ancestors
    else:
        return []