code: def kendall_tau(query_dic, mark):
      
      total = 0.0
      with open(kendall_tau_path + mark, 'w') as writer:
          for k in query_dic:
              candidate_lst = query_dic[k]
              ordered_lst = sorted(candidate_lst, key=lambda a: a[0], reverse=True)
              rank_lst = [can[1] for can in ordered_lst]
              tau_value = calculate_lst_kendall(rank_lst)
              writer.write('%s %f\n' % (k, tau_value))
              total += tau_value
      result_string = '%s\tkendall_tau:\t%f' % (mark, total / len(query_dic))
      print result_string
      # eval_result_dict['Kendall'].append(result_string)
      return ['Kendall', result_string]
docs: Calculate kendall_tau metric result of a method
      :param query_dic: dict, key is qid, value is (item, bleu) tuple list, which will be ranked by 'item' as key
      :param mark: string, which indicates which method is evaluated, also used as output file name here.
      :return: average kendall score