def edge_subgraph(self, edges):
        H = self.__class__()
        adj = self.adj
        # Filter out edges that don't correspond to nodes in the graph.
        def is_in_graph(u, v, k):
            return u in adj and v in adj[u] and k in adj[u][v]
        edges = (e for e in edges if is_in_graph(*e))
        for u, v, k in edges:
            # Copy the node attributes if they haven't been copied
            # already.
            if u not in H.node:
                H.node[u] = self.node[u]
            if v not in H.node:
                H.node[v] = self.node[v]
            # Create an entry in the adjacency dictionary for the
            # nodes u and v if they don't exist yet.
            if u not in H.adj:
                H.adj[u] = H.adjlist_dict_factory()
            if v not in H.adj:
                H.adj[v] = H.adjlist_dict_factory()
            # Create an entry in the edge dictionary for the edges (u,
            # v) and (v, u) if the don't exist yet.
            if v not in H.adj[u]:
                H.adj[u][v] = H.edge_key_dict_factory()
            if u not in H.adj[v]:
                H.adj[v][u] = H.edge_key_dict_factory()
            # Copy the edge attributes.
            H.edge[u][v][k] = self.edge[u][v][k]
            H.edge[v][u][k] = self.edge[v][u][k]
        H.graph = self.graph
        return H
Initialize the light.
dataset/ETHPy150Open networkx/networkx/networkx/classes/multigraph.py/MultiGraph.edge_subgraph--crossover with--dataset/ETHPy150Open home-assistant/home-assistant/homeassistant/components/light/blinksticklight.py/BlinkStickLight.__init__