def imap(requests, stream=True, pool=None, size=<NUM_LIT:2>, exception_handler=None):
def send(r):<EOL><INDENT>return r.send(stream=stream)<EOL><DEDENT>pool = pool if pool else Pool(size)<EOL>for request in pool.imap(send, requests):<EOL><INDENT>if request.response is not None:<EOL><INDENT>yield request.response<EOL><DEDENT>elif exception_handler:<EOL><INDENT>exception_handler(request, request.exception)<EOL><DEDENT><DEDENT>if not pool:<EOL><INDENT>pool.close()<EOL><DEDENT>
Concurrently converts a generator object of Requests to
    a generator of Responses.

    :param requests: a generator of Request objects.
    :param stream: If False, the content will not be downloaded immediately.
    :param size: Specifies the number of requests to make at a time. default is 2
    :param exception_handler: Callback function, called when exception occured. Params: Request, Exception