code: def parse_file_to_dict(
      file, assert2fields=False, value_processor=None
  ):
      """This function parses a file and pack the data into a dictionary
      It is useful for parsing file like wav.scp, utt2spk, text...etc
      """
      if value_processor is None:
          value_processor = lambda x: x[0]
      dict = {}
      for line in open(file, "r", encoding="utf-8"):
          parts = line.split()
          if assert2fields:
              assert len(parts) == 2
  
          dict[parts[0]] = value_processor(parts[1:])
      return dict
  
imports: import argparse, shlex, glob, math, os, random, sys, warnings, copy, imp, ast
label_desc: Use image node_id 4 for calling a global function with example usage: parse_file_to_dict(file, assert2fields, value_processor) and returns: dict