def as_even(iterator_cls):
 assert issubclass(iterator_cls, SubsetIterator)
 dct = ForcedEvenIterator.__dict__.copy()
 dct['_base_iterator_cls'] = iterator_cls
 dct['fancy'] = iterator_cls.fancy
 dct['stochastic'] = iterator_cls.stochastic
 NewForcedEvenClass = type(('ForcedEven%s' % iterator_cls.__name__), ForcedEvenIterator.__bases__, dct)
 return NewForcedEvenClass

def as_even ( iterator_cls ) : assert issubclass ( iterator_cls , SubsetIterator ) dct = ForcedEvenIterator . __dict__ . copy ( ) dct [ '_base_iterator_cls' ] = iterator_cls dct [ 'fancy' ] = iterator_cls . fancy dct [ 'stochastic' ] = iterator_cls . stochastic NewForcedEvenClass = type ( ( 'ForcedEven%s' % iterator_cls . __name__ ) , ForcedEvenIterator . __bases__ , dct ) return NewForcedEvenClass
returns a class wrapping iterator_cls that forces equal batch size .