docs: def query_retrieve_comments_or_remarks(
          recID,
          display_order='od',
          display_since='0000-00-00 00:00:00',
          ranking=0,
          limit='all',
          user_info=None):
      """
      Private function
      Retrieve tuple of comments or remarks from the database
      :param recID: record id
      :param display_order:   hh = highest helpful score
                              lh = lowest helpful score
                              hs = highest star score
                              ls = lowest star score
                              od = oldest date
                              nd = newest date
      :param display_since: datetime, e.g. 0000-00-00 00:00:00
      :param ranking: boolean, enabled if reviews, disabled for comments
      :param limit: number of comments/review to return
      :return: tuple of comment where comment is
              tuple (nickname, uid, date_creation, body, status, id) if ranking disabled or
              tuple (nickname, uid, date_creation, body, status, nb_votes_yes, nb_votes_total, star_score, title, id)
      Note: for the moment, if no nickname, will return email address up to ':'
      """
      display_since = calculate_start_date(display_since)
  
      order_dict = {
          'hh': "cmt.nb_votes_yes/(cmt.nb_votes_total+1) DESC, cmt.date_creation DESC ",
          'lh': "cmt.nb_votes_yes/(cmt.nb_votes_total+1) ASC, cmt.date_creation ASC ",
          'ls': "cmt.star_score ASC, cmt.date_creation DESC ",
          'hs': "cmt.star_score DESC, cmt.date_creation DESC ",
          'nd': "cmt.reply_order_cached_data DESC ",
          'od': "cmt.reply_order_cached_data ASC "}
  
      # Ranking only done for comments and when allowed
      if ranking and recID > 0:
          try:
              display_order = order_dict[display_order]
          except:
              display_order = order_dict['od']
      else:
          # in case of recID > 0 => external record => no ranking!
          ranking = 0
      try:
          if display_order[-1] == 'd':
              display_order = order_dict[display_order]
          else:
              display_order = order_dict['od']
      except:
          display_order = order_dict['od']
  
      #display_order = order_dict['nd']
      query = """SELECT user.nickname,
                        cmt.id_user,
                         """ + \
          datetime_format('cmt.date_creation', False, True) + ', ' \
          """
                        cmt.body,
                        cmt.status,
                        cmt.nb_abuse_reports,
                        %(ranking)s cmt.id,
                        cmt.round_name,
                        cmt.restriction,
                        %(reply_to_column)s
                 FROM   "cmtRECORDCOMMENT" cmt LEFT JOIN "user" ON
                                                "user".id=cmt.id_user
                 WHERE cmt.id_bibrec=%%s
                 %(ranking_only)s
                 %(display_since)s
                 ORDER BY %(display_order)s
                 """ % {'ranking'       : ranking and ' cmt.nb_votes_yes, cmt.nb_votes_total, cmt.star_score, cmt.title, ' or '',
                        'ranking_only': ranking and ' AND cmt.star_score>0 ' or ' AND cmt.star_score=0 ',
                        #                      'id_bibrec'     : recID > 0 and 'cmt.id_bibrec' or 'cmt.id_bibrec_or_bskEXTREC',
                        #                      'table'         : recID > 0 and 'cmtRECORDCOMMENT' or 'bskRECORDCOMMENT',
                        'display_since': display_since == '0000-00-00 00:00:00' and ' ' or 'AND cmt.date_creation>=\'%s\' ' % display_since,
                        'display_order': display_order,
                        'reply_to_column': recID > 0 and 'cmt."in_reply_to_id_cmtRECORDCOMMENT"' or 'cmt."in_reply_to_id_bskRECORDCOMMENT"'}
      params = (recID,)
      res = run_sql(query, params)
  #    return res
  
      new_limit = limit
      comments_list = []
      for row in res:
          if ranking:
              # when dealing with reviews, row[12] holds restriction info:
              restriction = row[12]
          else:
              # when dealing with comments, row[8] holds restriction info:
              restriction = row[8]
          if user_info and check_user_can_view_comment(
                  user_info, None, restriction)[0] != 0:
              # User cannot view comment. Look further
              continue
          comments_list.append(row)
          if limit.isdigit():
              new_limit -= 1
              if limit < 1:
                  break
  
      if comments_list:
          if limit.isdigit():
              return comments_list[:limit]
          else:
              return comments_list
      return ()