def write(self, obj, value, merge=False):
full = deepcopy(obj)<EOL>frag = full<EOL>parts, last = self.parts[:-<NUM_LIT:1>], self.parts[-<NUM_LIT:1>]<EOL>for part in parts:<EOL><INDENT>if isinstance(frag, dict):<EOL><INDENT>frag = frag[part]<EOL><DEDENT>elif isinstance(frag, (list, tuple)):<EOL><INDENT>frag = frag[int(part)]<EOL><DEDENT><DEDENT>if isinstance(frag, dict):<EOL><INDENT>if last in frag and merge:<EOL><INDENT>frag[last].update(value)<EOL><DEDENT>else:<EOL><INDENT>frag[last] = value<EOL><DEDENT><DEDENT>elif isinstance(frag, list):<EOL><INDENT>if last == '<STR_LIT:->':<EOL><INDENT>frag.append(value)<EOL><DEDENT>else:<EOL><INDENT>frag[int(last)] = value<EOL><DEDENT><DEDENT>return full<EOL>
Returns
    object: full copy of new obj