human
I wrote the below code

    @functools.wraps(astep_func)
    def step_decorator(astep_func, context, *args, **kwargs):
        loop = kwargs.pop('_loop', None)
        timeout = kwargs.pop('_timeout', None)
        async_context = kwargs.pop('_async_context', None)
        should_close = kwargs.pop('_should_close', None)
        if isinstance(loop, string_types):
            loop = getattr(context, loop, None)
        elif async_context:
            if isinstance(async_context, string_types):
                name = async_context
                async_context = use_or_create_async_context(context, name)
                loop = async_context.loop
            else:
                assert isinstance(async_context, AsyncContext)
                loop = async_context.loop
        if (loop is None):
            loop = (asyncio.get_event_loop() or asyncio.new_event_loop())
        try:
            if (timeout is None):
                loop.run_until_complete(astep_func(context, *args, **kwargs))
            else:
                task = loop.create_task(astep_func(context, *args, **kwargs))
                (done, pending) = loop.run_until_complete(asyncio.wait([task], timeout=timeout))
                assert (not pending), ('TIMEOUT-OCCURED:    timeout=%s' % timeout)
        finally:
            if (loop and should_close):
                loop.close()
    if (astep_func is None):
        def wrapped_decorator1(astep_func):
            @functools.wraps(astep_func)
            def wrapped_decorator2(context, *args, **kwargs):
                return step_decorator(astep_func, context, _loop=loop, _timeout=timeout, _async_context=async_context, _should_close=should_close, *args, **kwargs)
            assert callable(astep_func)
            return wrapped_decorator2
        return wrapped_decorator1
    else:
        assert callable(astep_func)
        @functools.wraps(astep_func)
        def wrapped_decorator(context, *args, **kwargs):
            return step_decorator(astep_func, context, *args, **kwargs)
        return wrapped_decorator

What's a good function header?

=====
Here's a good function header?
assistant
#Here's a good function header.

def async_run_until_complete(astep_func=None, loop=None, timeout=None, async_context=None, should_close=False):