@classmethod
def delete_subscript(class_, script, subscript):
    """
        Returns a script with the given subscript removed. The subscript
        must appear in the main script aligned to opcode boundaries for it
        to be removed.
        """
    new_script = bytearray()
    pc = 0
    for opcode, data, pc, new_pc in class_.ScriptTools.get_opcodes(script):
        section = script[pc:new_pc]
        if section != subscript:
            new_script.extend(section)
    return bytes(new_script)
