'Wrapps a callable in a scope which selects the current device.'

def __wrapped(self, function):

    @functools.wraps(function)
    def wrapper(*a, **kw):
        with context.local(device=self):
            return function(*a, **kw)
    return wrapper
