code: def parse(self, file=None, string=None):
          
          timer = metrics.Timer()
          timer.start()
          sax, handler = self.saxparser()
          if file is not None:
              sax.parse(file)
              timer.stop()
              metrics.log.debug('sax (%s) duration: %s', file, timer)
              return handler.nodes[0]
          if string is not None:
              if isinstance(string, str):
                  string = string.encode()
              parseString(string, handler)
              timer.stop()
              metrics.log.debug('%s\nsax duration: %s', string, timer)
              return handler.nodes[0]
docs: SAX parse XML text.
          @param file: Parse a python I{file-like} object.
          @type file: I{file-like} object.
          @param string: Parse string XML.
          @type string: str