I'm trying to write the following piece of code in python.

```
g = networkx.Digraph()
g.add_edge(1,2,x = 2)

```

The 'x' here is a variable. But networkx seems to take this as a name of the attribute. I need to pass what's inside x as the name of the attribute. How do I do it?