human
Give me a the Python code you requested given the following:
Complete the below
@contextlib.contextmanager
def multimap(cores=None):

    ''''Provide multiprocessing imap like function.
    The context manager handles setting up the pool, worked around interrupt issues
    and terminating the pool on completion.'
    '''
assistant
#Here is the Python code you requested.
    if (cores is None):
        cores = max((multiprocessing.cpu_count() - 1), 1)
    def wrapper(func):
        def wrap(self, timeout=None):
            return func(self, timeout=(timeout if (timeout is not None) else 1e+100))
        return wrap
    IMapIterator.next = wrapper(IMapIterator.next)
    pool = multiprocessing.Pool(cores)
    (yield pool.imap)
    pool.terminate()