docs: def _compilecode(function, name, impl, args, varargs, kwargs):
      """Get generated code.
  
      :return: function proxy generated code.
      :rtype: str
      """
  
      newcodestr, generatedname, impl_name = _generatecode(
          function=function, name=name, impl=impl,
          args=args, varargs=varargs, kwargs=kwargs
      )
  
      try:
          __file__ = getfile(function)
      except TypeError:
          __file__ = '<string>'
  
      # compile newcodestr
      code = compile(newcodestr, __file__, 'single')
  
      # define the code with the new function
      _globals = {}
      exec_(code, _globals)
  
      # get new code
      _var = _globals[generatedname]
      newco = get_function_code(_var)
  
      # get new consts list
      newconsts = list(newco.co_consts)
  
      if PY3:
          newcode = list(newco.co_code)
      else:
          newcode = [ord(co) for co in newco.co_code]
  
      consts_values = {impl_name: impl}
  
      # change LOAD_GLOBAL to LOAD_CONST
      index = 0
      newcodelen = len(newcode)
      while index < newcodelen:
          if newcode[index] == LOAD_GLOBAL:
              oparg = newcode[index + 1] + (newcode[index + 2] << 8)
              name = newco.co_names[oparg]
              if name in consts_values:
                  const_value = consts_values[name]
                  if const_value in newconsts:
                      pos = newconsts.index(const_value)
                  else:
                      pos = len(newconsts)
                      newconsts.append(consts_values[name])
                  newcode[index] = LOAD_CONST
                  newcode[index + 1] = pos & 0xFF
                  newcode[index + 2] = pos >> 8
          index += 1
  
      codeobj = getcodeobj(newconsts, newcode, newco, get_function_code(function))
      # instanciate a new function
      if function is None or isbuiltin(function):
          result = FunctionType(codeobj, {})
  
      else:
          result = type(function)(
              codeobj,
              get_function_globals(function),
              function.__name__,
              get_function_defaults(function),
              get_function_closure(function)
          )
  
      return result