def closure(source, pointerType, accumulator=None):
 if isinstance(source, Word):
  return reduce(union, map((lambda s, t=pointerType: tree(s, t)), source.getSenses()))
 _requireSource(source)
 if (accumulator is None):
  accumulator = []
 if (source not in accumulator):
  accumulator.append(source)
  for target in source.pointerTargets(pointerType):
   closure(target, pointerType, accumulator)
 return accumulator

def closure ( source , pointerType , accumulator = None ) : if isinstance ( source , Word ) : return reduce ( union , map ( ( lambda s , t = pointerType : tree ( s , t ) ) , source . getSenses ( ) ) ) _requireSource ( source ) if ( accumulator is None ) : accumulator = [ ] if ( source not in accumulator ) : accumulator . append ( source ) for target in source . pointerTargets ( pointerType ) : closure ( target , pointerType , accumulator ) return accumulator
return the transitive closure of source under the pointertype relationship .