#NEWLINE# def tupleCycle( val , concept , ancestorTuples = None ) : #NEWLINE# #INDENT# if ( ancestorTuples is None ) : #NEWLINE# #INDENT# ancestorTuples = set ( ) #NEWLINE# #UNINDENT# if ( concept in concept ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# ancestorTuples . add ( concept ) #NEWLINE# if ( concept . type is not None ) : #NEWLINE# #INDENT# for elementQname in concept . type . elements : #NEWLINE# #INDENT# childConcept = val . modelXbrl . qnameConcepts . get ( elementQname ) #NEWLINE# if ( ( childConcept is not None ) and tupleCycle ( val , childConcept , ancestorTuples ) ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# ancestorTuples . discard ( concept ) #NEWLINE# return False