code: def parse_cfg(cfgfile):
      def erase_comment(line):
          line = line.split("#")[0]
          return line
  
      blocks = []
      fp = open(cfgfile, "r")
      block = None
      line = fp.readline()
      while line != "":
          line = line.rstrip()
          if line == "" or line[0] == "#":
              line = fp.readline()
              continue
          elif line[0] == "[":
              if block:
                  blocks.append(block)
              block = OrderedDict()
              block["type"] = line.lstrip("[").rstrip("]")
              # set default value
              if block["type"] == "convolutional":
                  block["batch_normalize"] = 0
          else:
              line = erase_comment(line)
              key, value = line.split("=")
              key = key.strip()
              if key == "type":
                  key = "_type"
              value = value.strip()
              block[key] = value
          line = fp.readline()
  
      if block:
          blocks.append(block)
      fp.close()
      return blocks
  
file_path: MMdnn/mmdnn/conversion/darknet/cfg.py
imports: import torch
  from collections import OrderedDict
label_desc: Use image node_id 1 for calling a global function with example usage: parse_cfg(cfgfile) and returns: blocks, line