#NEWLINE# def check_defined_hashtype_signature( sig ) : #NEWLINE# #INDENT# from pycoin.tx.Tx import SIGHASH_ALL , SIGHASH_SINGLE , SIGHASH_ANYONECANPAY #NEWLINE# if ( len ( sig ) == 0 ) : #NEWLINE# #INDENT# raise ScriptError ( 'signature is length 0' ) #NEWLINE# #UNINDENT# hash_type = ( byte_to_int ( sig [ ( - 1 ) ] ) & ( ~ SIGHASH_ANYONECANPAY ) ) #NEWLINE# if ( ( hash_type < SIGHASH_ALL ) or ( hash_type > SIGHASH_SINGLE ) ) : #NEWLINE# #INDENT# raise ScriptError ( 'bad hash type after signature' )