#NEWLINE# def delete_subscript( script , subscript ) : #NEWLINE# #INDENT# 'Returns a script with the given subscript removed. The subscript\n    must appear in the main script aligned to opcode boundaries for it\n    to be removed.' #NEWLINE# new_script = bytearray ( ) #NEWLINE# pc = 0 #NEWLINE# size = len ( subscript ) #NEWLINE# while ( pc < len ( script ) ) : #NEWLINE# #INDENT# if ( script [ pc : ( pc + size ) ] == subscript ) : #NEWLINE# #INDENT# pc += size #NEWLINE# continue #NEWLINE# #UNINDENT# ( opcode , data , pc ) = get_opcode ( script , pc ) #NEWLINE# new_script . append ( opcode ) #NEWLINE# new_script += data #NEWLINE# #UNINDENT# return bytes ( new_script )