'Get a function with a EXTENDED_ARG opcode before a LOAD_CONST opcode.'

def get_extended_arg_load_const(self):

    def f():
        x = 5
        return x
    b = bytearray(f.__code__.co_code)
    consts = f.__code__.co_consts
    if (utils.PYVERSION >= (3, 6)):
        bytecode_len = 255
        bytecode_format = '<BB'
    else:
        bytecode_len = 65535
        bytecode_format = '<BH'
    consts = ((consts + ((None,) * bytecode_len)) + (42,))
    b[:0] = struct.pack(bytecode_format, dis.EXTENDED_ARG, 1)
    tweak_code(f, codestring=bytes(b), consts=consts)
    return f
