Distance Vector Algorithm In Python