def never_fail(f):
    'Assure that function never fails -- all exceptions are caught\n\n    Returns `None` if function fails internally.\n    '

    @wraps(f)
    def wrapped_func(*args, **kwargs):
        try:
            return f(*args, **kwargs)
        except Exception as e:
            lgr.warning(('DataLad internal failure while running %s: %r. Please report at https://github.com/datalad/datalad/issues' % (f, e)))
    if os.environ.get('DATALAD_ALLOW_FAIL', False):
        return f
    else:
        return wrapped_func
Assure that function never fails -- all exceptions are caught

Returns `None` if function fails internally.
def never_fail(f):
    'Assure that function never fails -- all exceptions are caught\n\n    Returns `None` if function fails internally.\n    '

    @wraps(f)
    def wrapped_func(*args, **kwargs):
        try:
            return f(*args, **kwargs)
        except Exception as e:
            lgr.warning(('DataLad internal failure while running %s: %r. Please report at https://github.com/datalad/datalad/issues' % (f, e)))
    if os.environ.get('DATALAD_ALLOW_FAIL', False):
        return f
    else:
        return wrapped_func