def defaults(default=None):
    """
    Catches any exception thrown by the wrapped function and returns `default`
    instead.

    Parameters
    ----------

    default : object
        The default value to return if the wrapped function throws an exception
    """
    def _f(func):
        @functools.wraps(func)
        def __f(self, *args, **kwargs):
            try:
                return func(self, *args, **kwargs)
            except Exception:
                return default
        return __f
    return _f
Catches any exception thrown by the wrapped function and returns `default`
    instead.

    Parameters
    ----------

    default : object
        The default value to return if the wrapped function throws an exception