in pythonflow/core.py [0:0]
def get_active_graph(graph=None):
"""
Obtain the currently active graph instance by returning the explicitly given graph or using
the default graph.
Parameters
----------
graph : Graph or None
Graph to return or `None` to use the default graph.
Raises
------
ValueError
If no `Graph` instance can be obtained.
"""
graph = graph or Graph._globals.default_graph
if not graph:
raise ValueError("`graph` must be given explicitly or a default graph must be set")
return graph