def safecall(f, default=None, exception=Exception):
    '''Returns modified f. When the modified f is called and throws an
    exception, the default value is returned'''
    def _safecall(*args,**argv):
        try:
            return f(*args,**argv)
        except exception:
            return default
    return _safecall
Returns modified f. When the modified f is called and throws an
    exception, the default value is returned
recipes/Python/576872_Exceptihandling_single/recipe-576872.py