def ignore_exception(exception_class):
 def _decorator(func):
  def newfunc(*args, **kwds):
   try:
    return func(*args, **kwds)
   except exception_class:
    pass
  return newfunc
 return _decorator

def ignore_exception ( exception_class ) : def _decorator ( func ) : def newfunc ( * args , ** kwds ) : try : return func ( * args , ** kwds ) except exception_class : pass return newfunc return _decorator
a decorator that ignores exception_class exceptions .