def _get_unpatched(cls):
 while cls.__module__.startswith('setuptools'):
  (cls,) = cls.__bases__
 if (not cls.__module__.startswith('distutils')):
  raise AssertionError(('distutils has already been patched by %r' % cls))
 return cls

def _get_unpatched ( cls ) : while cls . __module__ . startswith ( 'setuptools' ) : ( cls , ) = cls . __bases__ if ( not cls . __module__ . startswith ( 'distutils' ) ) : raise AssertionError ( ( 'distutils has already been patched by %r' % cls ) ) return cls
protect against re-patching the distutils if reloaded also ensures that no other distutils extension monkeypatched the distutils first .