class_docstr: Class representing a general ImageNet-style hierarchy.
class_docstr_tok: ["Class","representing","a","general","ImageNet-style","hierarchy","."]
docstr: Find all superclasses at a specified depth within a subtree
  of the hierarchy.
  
  Args:
      L (int): Depth in hierarchy (from root node)
      ancestor (str): (optional) WordNet ID that can be used to
                      restrict the subtree in which superclasses
                      are found
  
  Returns:
      nodes (list): Set of superclasses at that depth in 
                             the hierarchy
docstr_tok: ["Find","all","superclasses","at","a","specified","depth","within","a","subtree","of","the","hierarchy",".","Args",":","L","(","int",")",":","Depth","in","hierarchy","(","from","root","node",")","ancestor","(","str",")",":","(","optional",")","WordNet","ID","that","can","be","used","to","restrict","the","subtree","in","which","superclasses","are","found","Returns",":","nodes","(","list",")",":","Set","of","superclasses","at","that","depth","in","the","hierarchy"]
code: def get_nodes_at_level(self, L, ancestor=None):
      """
      Find all superclasses at a specified depth within a subtree
      of the hierarchy.
  
      Args:
          L (int): Depth in hierarchy (from root node)
          ancestor (str): (optional) WordNet ID that can be used to
                          restrict the subtree in which superclasses
                          are found
  
      Returns:
          nodes (list): Set of superclasses at that depth in
                                 the hierarchy
      """
      if ancestor is not None:
          valid = set(self.traverse([ancestor], direction="down"))
  
      nodes = set(
          [
              v
              for v in self.level_to_nodes[L]
              if ancestor is None or v in valid
          ]
      )
      return nodes
  
imports: import sys, os
  import json
  import numpy
  import pandas
  import urllib
  from collections import OrderedDict, Counter
  import operator
  import networkx
  from ..datasets import DATASETS
label_desc: Use image node_id 8 for calling the ClassHierarchy obj's underlying member method code with example usage: obj.get_nodes_at_level(L, ancestor) and returns: nodes