def sniff_version(stream):
 doc = parse(stream)
 scheme_el = doc.getroot()
 version = scheme_el.attrib.get('version', None)
 if (scheme_el.find('widgets') is not None):
  version = '1.0'
 else:
  version = '2.0'
 return version

def sniff_version ( stream ) : doc = parse ( stream ) scheme_el = doc . getroot ( ) version = scheme_el . attrib . get ( 'version' , None ) if ( scheme_el . find ( 'widgets' ) is not None ) : version = '1.0' else : version = '2.0' return version
parse a scheme stream and return the schemes serialization version string .