<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def check_task(taskid, timeout=DEFAULT_TASK_TIMEOUT, wait=2):
 """Wrap check_task. Args: taskid (str):
 Existing Spinnaker Task ID. timeout (int, optional):
 Consider Task failed after given seconds. wait (int, optional):
 Seconds to pause between polling attempts. Returns: str: Task status. Raises: AssertionError: API did not respond with a 200 status code. :obj:`foremast.exceptions.SpinnakerTaskInconclusiveError`: Task did not reach a terminal state before the given time out. """

    max_attempts = int(timeout / wait)
    try:
        return retry_call(
            partial(_check_task, taskid),
            max_attempts=max_attempts,
            wait=wait,
            exceptions=(AssertionError, ValueError), )
    except ValueError:
        raise SpinnakerTaskInconclusiveError('Task failed to complete in {0} seconds: {1}'.format(timeout, taskid))