def list2bytecode(l, opc, varnames, consts):
bc = []<EOL>for i, opcodes in enumerate(l):<EOL><INDENT>opname = opcodes[<NUM_LIT:0>]<EOL>operands = opcodes[<NUM_LIT:1>:]<EOL>if opname not in opc.opname:<EOL><INDENT>raise TypeError(<EOL>"<STR_LIT>" %<EOL>(i, opname, operands))<EOL><DEDENT>opcode = opc.opmap[opname]<EOL>bc.append(opcode)<EOL>print(opname, operands)<EOL>gen = (j for j in operands if operands)<EOL>for j in gen:<EOL><INDENT>k = (consts if opcode in opc.CONST_OPS else varnames).index(j)<EOL>if k == -<NUM_LIT:1>:<EOL><INDENT>raise TypeError(<EOL>"<STR_LIT>" %<EOL>(i, opname, operands))<EOL><DEDENT>else:<EOL><INDENT>bc += num2code(k)<EOL>pass<EOL><DEDENT>pass<EOL><DEDENT>pass<EOL><DEDENT>if opc.python_version < <NUM_LIT>:<EOL><INDENT>return reduce(lambda a, b: a + chr(b), bc, '<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>if PYTHON3:<EOL><INDENT>return bytes(bc)<EOL><DEDENT>else:<EOL><INDENT>return bytes(bytearray(bc))<EOL><DEDENT><DEDENT>
Convert list/tuple of list/tuples to bytecode
    _names_ contains a list of name objects