code: def get_topic_tree(rs, topic, depth=0):
      
  
      # Break if we're in too deep.
      if depth > rs._depth:
          rs._warn("Deep recursion while scanning topic trees!")
          return []
  
      # Collect an array of all topics.
      topics = [topic]
  
      # Does this topic include others?
      if topic in rs._includes:
          # Try each of these.
          for includes in sorted(rs._includes[topic]):
              topics.extend(get_topic_tree(rs, includes, depth + 1))
  
      # Does this topic inherit others?
      if topic in rs._lineage:
          # Try each of these.
          for inherits in sorted(rs._lineage[topic]):
              topics.extend(get_topic_tree(rs, inherits, depth + 1))
  
      return topics
docs: Given one topic, get the list of all included/inherited topics.
  
      :param str topic: The topic to start the search at.
      :param int depth: The recursion depth counter.
  
      :return []str: Array of topics.