'Make a name for a block of code, and cache the code.
Parameters
code : str
The Python source code to cache.
number : int
A number which forms part of the code\'s name. Used for the execution
counter.
Returns
The name of the cached code (as a string). Pass this as the filename
argument to compilation, so that tracebacks are correctly hooked up.'

def cache(self, code, number=0):

    name = code_name(code, number)
    entry = (len(code), time.time(), [(line + '\n') for line in code.splitlines()], name)
    linecache.cache[name] = entry
    linecache._ipython_cache[name] = entry
    return name
