def _modify_instruction_label_env(self, instruction, instr_key, instr_value):
if instruction == '<STR_LIT>':<EOL><INDENT>instructions = self.labels<EOL><DEDENT>elif instruction == '<STR_LIT>':<EOL><INDENT>instructions = self.envs<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>" % instruction)<EOL><DEDENT>if instr_key not in instructions:<EOL><INDENT>raise KeyError('<STR_LIT>' % (instr_key, instruction))<EOL><DEDENT>candidates = []<EOL>for insn in self.structure:<EOL><INDENT>if insn['<STR_LIT>'] == '<STR_LIT>':<EOL><INDENT>candidates = []<EOL><DEDENT>if insn['<STR_LIT>'] == instruction:<EOL><INDENT>candidates.append(insn)<EOL><DEDENT><DEDENT>content = startline = endline = None<EOL>for candidate in candidates:<EOL><INDENT>words = list(WordSplitter(candidate['<STR_LIT:value>']).split(dequote=False))<EOL>if '<STR_LIT:=>' not in words[<NUM_LIT:0>]:  <EOL><INDENT>if WordSplitter(words[<NUM_LIT:0>]).dequote() == instr_key:<EOL><INDENT>if instr_value is None:<EOL><INDENT>content = None<EOL><DEDENT>else:<EOL><INDENT>words[<NUM_LIT:1>:] = [quote(instr_value)]<EOL>content = "<STR_LIT:U+0020>".join([instruction] + words) + '<STR_LIT:\n>'<EOL><DEDENT>startline = candidate['<STR_LIT>']<EOL>endline = candidate['<STR_LIT>']<EOL>break<EOL><DEDENT><DEDENT>else:  <EOL><INDENT>for index, token in enumerate(words):<EOL><INDENT>key, _ = token.split("<STR_LIT:=>", <NUM_LIT:1>)<EOL>if WordSplitter(key).dequote() == instr_key:<EOL><INDENT>if instr_value is None:<EOL><INDENT>del words[index]<EOL><DEDENT>else:<EOL><INDENT>words[index] = "<STR_LIT>".format(key,<EOL>quote(instr_value))<EOL><DEDENT>if len(words) == <NUM_LIT:0>:<EOL><INDENT>content = None<EOL><DEDENT>else:<EOL><INDENT>content = "<STR_LIT:U+0020>".join([instruction] + words) + '<STR_LIT:\n>'<EOL><DEDENT>startline = candidate['<STR_LIT>']<EOL>endline = candidate['<STR_LIT>']<EOL>break<EOL><DEDENT><DEDENT><DEDENT><DEDENT>assert startline and endline<EOL>lines = self.lines<EOL>del lines[startline:endline + <NUM_LIT:1>]<EOL>if content:<EOL><INDENT>lines.insert(startline, content)<EOL><DEDENT>self.lines = lines<EOL>
set <INSTRUCTION> instr_key to instr_value

:param instr_key: str, label key
:param instr_value: str or None, new label/env value or None to remove