def _is_nested_instance(e, etypes):
 return (isinstance(e, etypes) or (isinstance(e, exceptions.MultipleExceptions) and any((_is_nested_instance(i, etypes) for i in e.inner_exceptions))))

def _is_nested_instance ( e , etypes ) : return ( isinstance ( e , etypes ) or ( isinstance ( e , exceptions . MultipleExceptions ) and any ( ( _is_nested_instance ( i , etypes ) for i in e . inner_exceptions ) ) ) )
check if exception or its inner excepts are an instance of etypes .