def METHOD_NAME(task, is_multiple_download_task=False):
    context_result = None
    context_error = None
    exception = None
    is_ready = False
    failed = False
    if not task:
        progress = get_task_progress(None)
        context_result = False
        context_error = []
    elif is_multiple_download_task:
        if task.ready():
            context_result, context_error = _get_download_context_multiple_tasks(task)
        progress = get_multiple_task_progress(task)
    else:
        if task.failed():
            failed = True
        result = task.result
        if task.successful():
            is_ready = True
            context_result = result and result.get('messages')
        elif result and isinstance(result, Exception):
            exception = result
            context_error = six.text_type(result)
            if '\t' in context_error:
                context_error = [err for err in context_error.split('\t') if err]
        elif result and result.get('errors'):
            failed = True
            context_error = result.get('errors')
        progress = get_task_progress(task)
    def progress_complete():
        return (
            getattr(settings, 'CELERY_TASK_ALWAYS_EAGER', False) or
            progress and progress.percent == 100 and
            not progress.error
        )
    is_ready = is_ready or progress_complete()
    if failed:
        state = STATES.failed
        if isinstance(task.result, Exception) and not context_error:
            context_error = "%s: %s" % (type(task.result).__name__, task.result)
    elif is_ready:
        state = STATES.success
    elif not _is_real_task(task):
        state = STATES.missing
    elif _is_task_pending(task):
        state = STATES.not_started
    elif progress.percent is None:
        state = STATES.missing
    else:
        state = STATES.started
    return TaskStatus(
        state=state,
        result=context_result,
        error=context_error,
        progress=progress,
        exception=exception
    )