code: def get_state_map(meta_graph, state_ops, unsupported_state_ops,
                    get_tensor_by_name):
    
    state_map = {}
    for node in meta_graph.graph_def.node:
      if node.op in state_ops:
        tensor_name = node.name + ":0"
        tensor = get_tensor_by_name(tensor_name)
        num_outputs = len(tensor.op.outputs)
        if num_outputs != 1:
          raise ValueError("Stateful op %s has %d outputs, expected 1" %
                           (node.op, num_outputs))
        state_map[tensor_name] = tensor
      if node.op in unsupported_state_ops:
        raise ValueError("Unsupported stateful op: %s" % node.op)
    return state_map
docs: Returns a map from tensor names to tensors that hold the state.