def class_instances_from_soap_enveloped_saml_thingies(text, modules):
 try:
  envelope = ElementTree.fromstring(text)
 except Exception as exc:
  raise XmlParseError(('%s' % exc))
 assert (envelope.tag == ('{%s}Envelope' % soapenv.NAMESPACE))
 assert (len(envelope) >= 1)
 env = {'header': [], 'body': None}
 for part in envelope:
  if (part.tag == ('{%s}Body' % soapenv.NAMESPACE)):
   assert (len(part) == 1)
   env['body'] = instanciate_class(part[0], modules)
  elif (part.tag == ('{%s}Header' % soapenv.NAMESPACE)):
   for item in part:
    env['header'].append(instanciate_class(item, modules))
 return env

def class_instances_from_soap_enveloped_saml_thingies ( text , modules ) : try : envelope = ElementTree . fromstring ( text ) except Exception as exc : raise XmlParseError ( ( '%s' % exc ) ) assert ( envelope . tag == ( '{%s}Envelope' % soapenv . NAMESPACE ) ) assert ( len ( envelope ) >= 1 ) env = { 'header' : [ ] , 'body' : None } for part in envelope : if ( part . tag == ( '{%s}Body' % soapenv . NAMESPACE ) ) : assert ( len ( part ) == 1 ) env [ 'body' ] = instanciate_class ( part [ 0 ] , modules ) elif ( part . tag == ( '{%s}Header' % soapenv . NAMESPACE ) ) : for item in part : env [ 'header' ] . append ( instanciate_class ( item , modules ) ) return env
parses a soap enveloped header and body saml thing and returns the thing as a dictionary class instance .