code: def _xml2dict(root):
      """Use functions instead of Class.
  
      remove namespace based on
      http://stackoverflow.com/questions/2148119
      """
      output = {}
      if root.items():
          output.update(dict(root.items()))
  
      for element in root:
          if len(element) > 0:
              if len(element) == 1 or element[0].tag != element[1].tag:
                  one_dict = _xml2dict(element)
              else:
                  one_dict = {_ns(element[0].tag): _xml2list(element)}
  
              if element.items():
                  one_dict.update(dict(element.items()))
              output.update({_ns(element.tag): one_dict})
  
          elif element.items():
              output.update({_ns(element.tag): dict(element.items())})
  
          else:
              output.update({_ns(element.tag): element.text})
      return output
  
file_path: mne-python/mne/io/egi/events.py
imports: from datetime import datetime
  from glob import glob
  from os.path import basename, join, splitext
  import numpy
  from ...utils import _soft_import, logger
label_desc: Use image node_id 6 for calling a global function with example usage: _xml2dict(root) and returns: output