#NEWLINE# def words_to_int( words , word_size , num_words ) : #NEWLINE# #INDENT# '\n    :param words: A sequence of unsigned integer word values.\n\n    :param word_size: Width (in bits) of each unsigned integer word value.\n\n    :param num_words: Number of unsigned integer words expected.\n\n    :return: An unsigned integer that is equivalent to value represented\n        by word sequence.\n    ' #NEWLINE# if ( not valid_words ( words , word_size , num_words ) ) : #NEWLINE# #INDENT# raise ValueError ( ( 'invalid integer word sequence: %r!' % words ) ) #NEWLINE# #UNINDENT# int_val = 0 #NEWLINE# for ( i , num ) in enumerate ( reversed ( words ) ) : #NEWLINE# #INDENT# word = num #NEWLINE# word = ( word << ( word_size * int_val ) ) #NEWLINE# int_val = ( int_val | word ) #NEWLINE# #UNINDENT# return int_val