code: def cmp_to_key(cmp_func):
      """Convert a cmp=fcuntion into a key=function."""
  
      class K(object):
          def __init__(self, obj, *args):
              self.obj = obj
  
          def __lt__(self, other):
              return cmp_func(self.obj, other.obj) < 0
  
          def __gt__(self, other):
              return cmp_func(self.obj, other.obj) > 0
  
          def __eq__(self, other):
              return cmp_func(self.obj, other.obj) == 0
  
      return K
  
file_path: clearml/clearml/utilities/pigar/utils.py
imports: from __future__ import print_function, division, absolute_import
  import os
  import re
  import sys
  import difflib
label_desc: Use image node_id 2 for calling a global function with example usage: cmp_to_key(cmp_func) and returns: K, unknown, unknown, unknown