#NEWLINE# def decode_descriptor( _ , fp ) : #NEWLINE# #INDENT# name = read_unicode_string ( fp ) [ : ( - 1 ) ] #NEWLINE# classID_length = read_fmt ( 'I' , fp ) [ 0 ] #NEWLINE# classID = fp . read ( ( classID_length or 4 ) ) #NEWLINE# items = [ ] #NEWLINE# item_count = read_fmt ( 'I' , fp ) [ 0 ] #NEWLINE# for n in range ( item_count ) : #NEWLINE# #INDENT# item_length = read_fmt ( 'I' , fp ) [ 0 ] #NEWLINE# key = fp . read ( ( item_length or 4 ) ) #NEWLINE# ostype = fp . read ( 4 ) #NEWLINE# decode_ostype = get_ostype_decode_func ( ostype ) #NEWLINE# if ( not decode_ostype ) : #NEWLINE# #INDENT# raise UnknownOSType ( ( 'Unknown descriptor item of type %r' % ostype ) ) #NEWLINE# #UNINDENT# value = decode_ostype ( key , fp ) #NEWLINE# if ( value is not None ) : #NEWLINE# #INDENT# items . append ( ( key , value ) ) #NEWLINE# #UNINDENT# #UNINDENT# return Descriptor ( name , classID , items )