parameters: (sgv, graph)
return_statement: return sgv
docstring: Check if sgv belongs to the given graph.
  
    Args:
      sgv: a SubGraphView.
      graph: a graph or None.
    Returns:
      The SubGraphView sgv.
    Raises:
      TypeError: if sgv is not a SubGraphView or if graph is not None and not
        a tf.Graph.
      ValueError: if the graph of sgv and the given graph are not None and
        different.
docstring_summary: Check if sgv belongs to the given graph.
docstring_tokens: Check if sgv belongs to the given graph .
function: def _check_graph(sgv, graph):
    """Check if sgv belongs to the given graph.
  
    Args:
      sgv: a SubGraphView.
      graph: a graph or None.
    Returns:
      The SubGraphView sgv.
    Raises:
      TypeError: if sgv is not a SubGraphView or if graph is not None and not
        a tf.Graph.
      ValueError: if the graph of sgv and the given graph are not None and
        different.
    """
    if not isinstance(sgv, SubGraphView):
      raise TypeError("Expected a SubGraphView, got: {}".format(type(graph)))
    if graph is None or not sgv.graph:
      return sgv
    if not isinstance(graph, tf_ops.Graph):
      raise TypeError("Expected a tf.Graph, got: {}".format(type(graph)))
    if sgv.graph is not graph:
      raise ValueError("Graph mismatch.")
    return sgv
function_tokens: def _check_graph ( sgv , graph ) : if not isinstance ( sgv , SubGraphView ) : raise TypeError ( "Expected a SubGraphView, got: {}" . format ( type ( graph ) ) ) if graph is None or not sgv . graph : return sgv if not isinstance ( graph , tf_ops . Graph ) : raise TypeError ( "Expected a tf.Graph, got: {}" . format ( type ( graph ) ) ) if sgv . graph is not graph : raise ValueError ( "Graph mismatch." ) return sgv