def print_solution(solution):
    """Prints a solution
    
    Arguments
    ---------
    solution : BaseSolution

    Example
    -------
    ::
    
        [8, 9, 10, 7]: 160
        [5, 6]: 131
        [3, 4, 2]: 154
        Total cost: 445
        
    """
    total_cost = 0
    for solution in solution.routes():
        cost = solution.length()
        total_cost = total_cost + cost
        print('{}: {}'.format(solution, cost))
        #print('xxx')
    print('Total cost: {}'.format(total_cost))
Prints a solution
    
    Arguments
    ---------
    solution : BaseSolution

    Example
    -------
    ::
    
        [8, 9, 10, 7]: 160
        [5, 6]: 131
        [3, 4, 2]: 154
        Total cost: 445