code: def parse(stream):
          
          definition = InputDefinition()
  
          # parse XML from the stream, then get the root node
          root = ET.parse(stream).getroot()
  
          for node in root:
              if node.tag == "configuration":
                  # get config for each stanza
                  definition.inputs = parse_xml_data(node, "stanza")
              else:
                  definition.metadata[node.tag] = node.text
  
          return definition
docs: Parse a stream containing XML into an ``InputDefinition``.
  
          :param stream: stream containing XML to parse.
          :return: definition: an ``InputDefinition`` object.