human
Give me a Python function for multiprocessing map imap.
assistant
Here is a Python function for multiprocessing map imap

import multiprocessing

def map_imap(f, l, n_jobs=1):
    """
    Map function f over list l in parallel using n_jobs processes.
    Returns a generator.
    """
    if n_jobs == 1:
        for x in f(l):
            yield x
    else:
        return map(f, l, n_jobs)

# Enter the list
myList = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

# Calling the function
print((map_imap(lambda x: x * x, myList)))

#Example Output
# <generator object map_imap at 0x7f419a019f90>

#Remember to inspect code for bugs.