code: def load_kv_dict(
      dict_path,
      reverse=False,
      delimiter="\t",
      key_func=None,
      value_func=None,
  ):
      """
      Load key-value dict from file
      """
      result_dict = {}
      for line in io.open(dict_path, "r", encoding="utf8"):
          terms = line.strip("\n").split(delimiter)
          if len(terms) != 2:
              continue
          if reverse:
              value, key = terms
          else:
              key, value = terms
          if key in result_dict:
              raise KeyError("key duplicated with [%s]" % (key))
          if key_func:
              key = key_func(key)
          if value_func:
              value = value_func(value)
          result_dict[key] = value
      return result_dict
  
imports: import io
  import numpy
  import six
label_desc: Use image node_id 1 for calling a global function with example usage: load_kv_dict(dict_path, reverse, delimiter, key_func, value_func) and returns: result_dict