<s> from . base import ( Entity , EntityList , TypedCollection , TypedList , <EOL> BaseCoreComponent ) <EOL> _EXTENSION_MAP = { } <EOL> def _lookup_unprefixed ( typename ) : <EOL> """<STR_LIT>""" <EOL> for xsi_type , klass in _EXTENSION_MAP . iteritems ( ) : <EOL> if typename in xsi_type : <EOL> return klass <EOL> error = "<STR_LIT>" % typename <EOL> raise ValueError ( error ) <EOL> def _lookup_extension ( xsi_type ) : <EOL> """<STR_LIT>""" <EOL> if xsi_type in _EXTENSION_MAP : <EOL> return _EXTENSION_MAP [ xsi_type ] <EOL> raise ValueError ( "<STR_LIT>" % xsi_type ) <EOL> def lookup_extension ( typeinfo , default = None ) : <EOL> """<STR_LIT>""" <EOL> if typeinfo is None and default : <EOL> return default <EOL> if isinstance ( typeinfo , basestring ) : <EOL> return _lookup_extension ( typeinfo ) <EOL> if not hasattr ( typeinfo , '<STR_LIT>' ) : <EOL> if default : <EOL> return default <EOL> error = "<STR_LIT>" <EOL> raise ValueError ( error ) <EOL> if hasattr ( typeinfo , '<STR_LIT>' ) : <EOL> xsi_type = "<STR_LIT>" % ( typeinfo . xmlns_prefix , typeinfo . xml_type ) <EOL> return _lookup_extension ( xsi_type ) <EOL> return _lookup_unprefixed ( typeinfo . xml_type ) <EOL> def add_extension ( cls ) : <EOL> """<STR_LIT>""" <EOL> _EXTENSION_MAP [ cls . _XSI_TYPE ] = cls <EOL> def register_extension ( cls ) : <EOL> """<STR_LIT>""" <EOL> add_extension ( cls ) <EOL> return cls <EOL> from . import common <EOL> from . version import __version__ <EOL> def supported_stix_version ( ) : <EOL> """<STR_LIT>""" <EOL> return ( '<STR_LIT>' , '<STR_LIT>' ) </s>
