human
Complete the below
def concurrently_execute(func, args, limit):

    ''''Executes the function with each argument conncurrently while limiting
    the number of concurrent executions.
    Args:
    func (func): Function to execute, should return a deferred.
    args (list): List of arguments to pass to func, each invocation of func
    gets a signle argument.
    limit (int): Maximum number of conccurent executions.
    Returns:
    deferred: Resolved when all function invocations have finished.'
    '''
assistant
#Here is the Python code you requested.
    it = iter(args)
    @defer.inlineCallbacks
    def _concurrently_execute_inner():
        try:
            while True:
                (yield func(it.next()))
        except StopIteration:
            pass
    return preserve_context_over_deferred(defer.gatherResults([preserve_fn(_concurrently_execute_inner)() for _ in xrange(limit)], consumeErrors=True)).addErrback(unwrapFirstError)