def show_chain(*chains, **kw):
 backrefs = kw.pop('backrefs', True)
 chains = [chain for chain in chains if chain]
 def in_chains(x, ids=set(map(id, itertools.chain(*chains)))):
  return (id(x) in ids)
 max_depth = (max(map(len, chains)) - 1)
 if backrefs:
  show_backrefs([chain[(-1)] for chain in chains], max_depth=max_depth, filter=in_chains, **kw)
 else:
  show_refs([chain[0] for chain in chains], max_depth=max_depth, filter=in_chains, **kw)

def show_chain ( * chains , ** kw ) : backrefs = kw . pop ( 'backrefs' , True ) chains = [ chain for chain in chains if chain ] def in_chains ( x , ids = set ( map ( id , itertools . chain ( * chains ) ) ) ) : return ( id ( x ) in ids ) max_depth = ( max ( map ( len , chains ) ) - 1 ) if backrefs : show_backrefs ( [ chain [ ( - 1 ) ] for chain in chains ] , max_depth = max_depth , filter = in_chains , ** kw ) else : show_refs ( [ chain [ 0 ] for chain in chains ] , max_depth = max_depth , filter = in_chains , ** kw )
show a chain of object references .