code: def get_span(docgraph, node_id, debug=False):
      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
          if edge_attribs['edge_type'] != EdgeTypes.pointing_relation:
              span.extend(get_span(docgraph, target_id))
      return sorted(span, key=natural_sort_key)