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)

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)