'Apply a function but emulate the API of an asynchronous call.
Parameters
f : callable
The function to call.
args : tuple, optional
The positional arguments.
kwargs : dict, optional
The keyword arguments.
Returns
future : ApplyAsyncResult
The result of calling the function boxed in a future-like api.
Notes
This calls the function eagerly but wraps it so that ``SequentialPool``
can be used where a :class:`multiprocessing.Pool` or
:class:`gevent.pool.Pool` would be used.'

@staticmethod
def apply_async(f, args=(), kwargs=None, callback=None):

    try:
        value = (identity if (callback is None) else callback)(f(*args, **(kwargs or {})))
        successful = True
    except Exception as e:
        value = e
        successful = False
    return ApplyAsyncResult(value, successful)
