def calculate_deployment_wait_time(test_obj, failure_count=0):
    """ Calculates wait time based potentially a number of factors.
        If we need an exponential backoff this is the place.

        possbilities:
            deploy_results.avg_response_time,
            deploy_results.last_response_time
            failure_count
            outstanding_deployments
            current_scale

        max response time is 10s, as we approach that bad things happen

        return time in seconds to wait
    """
    deploy_results = test_obj.deploy_results

    wait_time = 1
    if deploy_results.last_response_time < 1:
        wait_time = 1
    elif deploy_results.last_response_time > 8:
        wait_time = 5

    if failure_count > 3 and failure_count < 7:
        wait_time = wait_time + 5
    elif failure_count > 7:
        wait_time = wait_time + 10

    return wait_time