def is_task_complete(task, task_runs, redundancy, task_id_field='id', task_run_id_field='task_id', error=None):

    """
    Checks to see if a task is complete.  Slightly more optimized than
    doing: len(get_task_runs())

    :param task: input task object
    :type task: dict
    :param task_runs: content from task_run.json
    :type task_runs: list
    :param redundancy: number of times a task must be completed
    :type redundancy: int
    :param task_id_field: the key used to get the unique task identifier
    :type task_id_field: str
    :param task_run_id_field: the key used to get the unique task_run identifier
    :type task_run_id_field: str
    :param error: the value that is returned when an error is encountered
    :type error: any
    :rtype: bool|None
    """

    # Validate input
    if redundancy <= 0:
        return error

    # Loop and check
    count = 0
    task_id = task[task_id_field]
    for tr in task_runs:
        tr_id = tr[task_run_id_field]
        if task_id == tr_id:
            count += 1
            if count >= redundancy:
                return True
    return False