def check_duplicate_segments(segments, is_partial_func=None):
 if (is_partial_func is not None):
  segments = [s for s in segments if (not is_partial_func(s))]
 fully_specifieds = [tuple(sorted(s.items())) for s in segments]
 if (len(set(fully_specifieds)) != len(fully_specifieds)):
  raise SegmentsContainDuplicateEntry()

def check_duplicate_segments ( segments , is_partial_func = None ) : if ( is_partial_func is not None ) : segments = [ s for s in segments if ( not is_partial_func ( s ) ) ] fully_specifieds = [ tuple ( sorted ( s . items ( ) ) ) for s in segments ] if ( len ( set ( fully_specifieds ) ) != len ( fully_specifieds ) ) : raise SegmentsContainDuplicateEntry ( )
helper function checking duplicate segments .