decorator to silence exceptions, for logging
        we want a "safe" fail of the functions

def inside_try(func, options={}):
    """ decorator to silence exceptions, for logging
        we want a "safe" fail of the functions """
    if six.PY2:
        name = func.func_name
    else:
        name = func.__name__

    @wraps(func)
    def silenceit(*args, **kwargs):
        """ the function func to be silenced is wrapped inside a
        try catch and returned, exceptions are logged
        exceptions are returned in an error dict
        takes all kinds of arguments and passes to the original func
        """
        excpt = None
        try:
            return func(*args, **kwargs)
        # pylint: disable=W0703
        # inside_try.silenceit: Catching too general exception Exception
        # that's the idea!
        except Exception as excpt:
            # first tell the object in charge
            if 'ctx' in kwargs:
                ctx = kwargs['ctx']
            else:
                # otherwise tell object defined in options
                # if we can be sure there is a context
                ctx = get_try_option(None, 'ctx')

            if not ctx:
                # tell a new object
                ctx = Bubble('Inside Try')
                # ctx.set_verbose(100); #todo: move to magic

            head = name + ': silenced function inside_try:Error:'
            if get_try_option(ctx, 'count_it'):
                ctx.gbc.cry(head + 'counting')
            if get_try_option(ctx, 'print_it'):
                ctx.gbc.cry(head + 'printing:' + str(excpt))
            if get_try_option(ctx, 'print_args'):
                ctx.gbc.cry(head + 'printing ak:' + str(excpt))
                ctx.gbc.cry('args', stuff=args)
                ctx.gbc.cry('kwargs', stuff=kwargs)
            if get_try_option(ctx, 'inspect_it'):
                ctx.gbc.cry(head + 'inspecting:', stuff=excpt)
                for s in inspect.stack():
                    ctx.gbc.cry(head + ':stack:', stuff=s)
            if get_try_option(ctx, 'log_it'):
                ctx.gbc.cry(head + 'logging')
                for s in inspect.stack():
                    ctx.gbc.cry(head + ':stack:', stuff=s)
            if get_try_option(ctx, 'reraise_it'):
                ctx.gbc.cry(head + 'reraising')
                raise excpt
            # always return error
            return {'error': str(excpt),
                    'silenced': name,
                    'args': args,
                    'kwargs': kwargs}
    return silenceit