'Compile the function or retrieve an already compiled result
from the cache.'

def compile(self, func, args, return_type=None, flags=DEFAULT_FLAGS):

    from numba.targets.registry import cpu_target
    cache_key = (func, args, return_type, flags)
    try:
        cr = self.cr_cache[cache_key]
    except KeyError:
        with cpu_target.nested_context(self.typingctx, self.targetctx):
            cr = compile_extra(self.typingctx, self.targetctx, func, args, return_type, flags, locals={})
        self.cr_cache[cache_key] = cr
    return cr
