#NEWLINE# def lookup_extension( typeinfo , default = None ) : #NEWLINE# #INDENT# 'Looks up the binding class for `typeinfo`, which is a namespace/typename\n    pairing.\n\n    Args:\n        typeinfo: An lxml Element node or a stix.bindings.TypeInfo namedtuple.\n        default: A binding class that will be returned if typeinfo is an\n            Element without an xsi:type attribute.\n\n    Returns:\n        A binding class that has been registered for the namespace and typename\n        found on `typeinfo`.\n\n    ' #NEWLINE# if ( not isinstance ( typeinfo , TypeInfo ) ) : #NEWLINE# #INDENT# if has_xsi_type ( typeinfo ) : #NEWLINE# #INDENT# typeinfo = get_type_info ( typeinfo ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if default : #NEWLINE# #INDENT# return default #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( typeinfo in _BINDING_EXTENSION_MAP ) : #NEWLINE# #INDENT# return _BINDING_EXTENSION_MAP [ typeinfo ] #NEWLINE# #UNINDENT# fmt = "No class implemented or registered for XML type '{%s}%s'" #NEWLINE# error = ( fmt % ( typeinfo . ns , typeinfo . typename ) ) #NEWLINE# raise NotImplementedError ( error )