nodes: 0, module; 1, function_definition; 2, function_name:get_span; 3, parameters; 4, block; 5, identifier:docgraph; 6, identifier:node_id; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, if_statement; 12, for_statement; 13, return_statement; 14, identifier:debug; 15, False; 16, comment:"""
      returns all the tokens that are dominated or in a span relation with
      the given node. If debug is set to True, you'll get a warning if the
      graph is cyclic.
  
      Returns
      -------
      span : list of str
          sorted list of token nodes (token node IDs)
      """; 17, boolean_operator; 18, block; 19, assignment; 20, comparison_operator:docgraph.ns+':token' in docgraph.node[node_id]; 21, block; 22, pattern_list; 23, call; 24, block; 25, call; 26, comparison_operator:debug is True; 27, comparison_operator:is_directed_acyclic_graph(docgraph) is False; 28, expression_statement; 29, identifier:span; 30, list; 31, binary_operator:docgraph.ns+':token'; 32, subscript; 33, expression_statement; 34, identifier:src_id; 35, identifier:target_id; 36, identifier:edge_attribs; 37, attribute; 38, argument_list; 39, if_statement; 40, comment:# ignore pointing relations; 41, if_statement; 42, identifier:sorted; 43, argument_list; 44, identifier:debug; 45, True; 46, call; 47, False; 48, call; 49, attribute; 50, string; 51, attribute; 52, identifier:node_id; 53, call; 54, identifier:docgraph; 55, identifier:out_edges_iter; 56, identifier:node_id; 57, keyword_argument; 58, comparison_operator:src_id == target_id; 59, block; 60, comparison_operator:edge_attribs['edge_type'] != EdgeTypes.pointing_relation; 61, block; 62, identifier:span; 63, keyword_argument; 64, identifier:is_directed_acyclic_graph; 65, argument_list; 66, attribute; 67, argument_list; 68, identifier:docgraph; 69, identifier:ns; 70, string_content::token; 71, identifier:docgraph; 72, identifier:node; 73, attribute; 74, argument_list; 75, identifier:data; 76, True; 77, identifier:src_id; 78, identifier:target_id; 79, continue_statement; 80, comment:# ignore self-loops; 81, subscript; 82, attribute; 83, expression_statement; 84, identifier:key; 85, identifier:natural_sort_key; 86, identifier:docgraph; 87, identifier:warnings; 88, identifier:warn; 89, call; 90, identifier:span; 91, identifier:append; 92, identifier:node_id; 93, identifier:edge_attribs; 94, string; 95, identifier:EdgeTypes; 96, identifier:pointing_relation; 97, call; 98, attribute; 99, argument_list; 100, string_content:edge_type; 101, attribute; 102, argument_list; 103, parenthesized_expression; 104, identifier:format; 105, identifier:node_id; 106, identifier:docgraph; 107, identifier:span; 108, identifier:extend; 109, call; 110, concatenated_string; 111, identifier:get_span; 112, argument_list; 113, string:"Can't reliably extract span '{0}' from cyclical graph'{1}'."; 114, string:"Maximum recursion depth may be exceeded."; 115, identifier:docgraph; 116, identifier:target_id
code: def get_span(docgraph, node_id, debug=False):
      """
      returns all the tokens that are dominated or in a span relation with
      the given node. If debug is set to True, you'll get a warning if the
      graph is cyclic.
  
      Returns
      -------
      span : list of str
          sorted list of token nodes (token node IDs)
      """
      if debug is True and is_directed_acyclic_graph(docgraph) is False:
          warnings.warn(
              ("Can't reliably extract span '{0}' from cyclical graph'{1}'."
              "Maximum recursion depth may be exceeded.").format(node_id,
                                                                     docgraph))
      span = []
      if docgraph.ns+':token' in docgraph.node[node_id]:
          span.append(node_id)
  
      for src_id, target_id, edge_attribs in docgraph.out_edges_iter(node_id,
                                                                  data=True):
          if src_id == target_id:
              continue  # ignore self-loops
          # ignore pointing relations
          if edge_attribs['edge_type'] != EdgeTypes.pointing_relation:
              span.extend(get_span(docgraph, target_id))
      return sorted(span, key=natural_sort_key)