I have a networkx DiGraph and I want to extract a subgraph from it by passing in a list of nodes. The subgraph however can contain all nodes that might be in between the nodes that I have passed. I checked `nx.subgraph()` but it does not work like I intend to. As for a small example:

```
import networkx as nx

G = nx.DiGraph()
edges = [(7, 4), (3, 8), (3, 2), (3, 0), (3, 1), (7, 5), (7, 6), (7, 8)]
G.add_edges_from(edges)
H = get_subgraph(G, [0,6,7,8])

```

How can I write the function `get_subgraph()` so that H has the edges `[(3, 8), (3, 0), (7, 6), (7, 8)]`? 
The subgraph I need is such that it contains all the nodes that are in the ougoing and incoming paths between the nodes that I pass in the `get_subgraph()`function. 
![The subgraph I want from the graph](https://i.stack.imgur.com/GD3le.gif)