def get_node_wrapped_tensor_info(meta_graph_def,
                                 path):
  """Get the Any-wrapped TensorInfo for the node from the meta_graph_def.

  Args:
     meta_graph_def: MetaGraphDef containing the CollectionDefs to extract the
       node name from.
     path: Name of the collection containing the node name.

  Returns:
    The Any-wrapped TensorInfo for the node retrieved from the CollectionDef.

  Raises:
    KeyError: There was no CollectionDef with the given name (path).
    ValueError: The any_list in the CollectionDef with the given name did
      not have length 1.
  """
  if path not in meta_graph_def.collection_def:
    raise KeyError('could not find path %s in collection defs. meta_graph_def '
                   'was %s' % (path, meta_graph_def))
  if len(meta_graph_def.collection_def[path].any_list.value) != 1:
    raise ValueError(
        'any_list should be of length 1. path was %s, any_list was: %s.' %
        (path, meta_graph_def.collection_def[path].any_list.value))
  return meta_graph_def.collection_def[path].any_list.value[0]