Wraps a function so that all unspecified arguments will be injected if
        possible. Specified arguments always have precedence.

def wrap(self, function):
        """
        Wraps a function so that all unspecified arguments will be injected if
        possible. Specified arguments always have precedence.
        """
        func = inspect.getfullargspec(function)
        needed_arguments = func.args + func.kwonlyargs

        @wraps(function)
        def wrapper(*args, **kwargs):
            arguments = kwargs.copy()
            missing_arguments = needed_arguments - arguments.keys()
            for arg in missing_arguments:
                try:
                    arguments[arg] = self._get_argument(arg)
                except KeyError:
                    pass
            return function(*args, **arguments)

        return wrapper