<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def dictionary(_object, *args):
 """ Validates a given input is of type dictionary. Example usage:: data = {'a' : {'b': 1}} schema = ('a', dictionary) You can also use this as a decorator, as a way to check for the input before it even hits a validator you may be writing. .. note:: If the argument is a callable, the decorating behavior will be triggered, otherwise it will act as a normal function. """

    error_msg = 'not of type dictionary'
    if is_callable(_object):
        _validator = _object

        @wraps(_validator)
        def decorated(value):
            ensure(isinstance(value, dict), error_msg)
            return _validator(value)
        return decorated
    try:
        ensure(isinstance(_object, dict), error_msg)
    except AssertionError:
        if args:
            msg = 'did not pass validation against callable: dictionary'
            raise Invalid('', msg=msg, reason=error_msg, *args)
        raise