Generalize item_span into node_span, which works on more types.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>