<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def keyed_helper(helper):
 """ Decorator for helper functions that operate on direct values instead of model instances. A keyed helper is one that can be used normally in the view's own custom callbacks, but also supports direct access in the column declaration, such as in the example: datatable_options = { 'columns': [ ('Field Name', 'fieldname', make_boolean_checkmark(key=attrgetter('fieldname'))), ], } With the help of a ``sort``-style ``key`` argument, the helper can receive all the information it requires in advance, so that the view doesn't have to go through the trouble of declaring a custom callback method that simply returns the value of the ``make_boolean_checkmark()`` helper. If the attribute being fetched is identical to the one pointed to in the column declaration, even the ``key`` argument can be omitted: ('Field Name', 'fieldname', make_boolean_checkmark)), """


    @wraps(helper)
    def wrapper(instance=None, key=None, attr=None, *args, **kwargs):
        if set((instance, key, attr)) == {None}:
            # helper was called in place with neither important arg
            raise ValueError("If called directly, helper function '%s' requires either a model"
                             " instance, or a 'key' or 'attr' keyword argument." % helper.__name__)

        if instance is not None:
            return helper(instance, *args, **kwargs)

        if key is None and attr is None:
            attr = 'self'

        if attr:
            if attr == 'self':
                key = lambda obj: obj
            else:
                key = operator.attrgetter(attr)

        # Helper is used directly in the columns declaration.  A new callable is
        # returned to take the place of a callback.
        @wraps(helper)
        def helper_wrapper(instance, *args, **kwargs):
            return helper(key(instance), *args, **kwargs)
        return helper_wrapper

    wrapper._is_wrapped = True
    return wrapper