<｜begin▁of▁sentence｜>### Instruction:
Imagine you're at a school administrators' meeting where the main topic of discussion is optimizing the route of the school's supply chain for educational materials. Your team has mapped out a proposed delivery path among various departments within the school, with each step having an associated cost. Specifically, the proposed route includes transitions from the storeroom (0) to the science department (1) with a logistical cost of 2 units, from the science department (1) to the mathematics department (2) costing 4 units, from mathematics (2) to the language arts department (3) with a cost of 3 units, and finally, from language arts (3) to the history department (4) at a cost of 2 units.

As the principal, you are conscious of budget constraints and seek to comprehend the total expense implicated in this delivery sequence. To ensure the efficient allocation of resources, which in turn directly correlates to academic success and operational effectiveness, it is crucial to calculate the aggregate cost of this branching supply route. Could your administrations team aid in determining the total weighted cost of this hypothetical distribution network using specialized analysis software adept at handling such directed graphs with weighted edges?
### Response:
import networkx as nx

# Create a directed graph
G = nx.DiGraph()

# Add weighted edges
e1 = (0, 1, 2) # edge from 0 to 1 with weight 2
e2 = (1, 2, 4) # edge from 1 to 2 with weight 4
e3 = (2, 3, 3) # edge from 2 to 3 with weight 3
e4 = (3, 4, 2) # edge from 3 to 4 with weight 2
G.add_weighted_edges_from([e1, e2, e3, e4])

# Calculate the total weight of the branching
weight = nx.tree.branching_weight(G)

print('The total weight of the branching is:', weight)
<|EOT|>
