code: def adapts(**schemas):
      validate = parse(schemas).validate
      @decorator
      def adapting(func, *args, **kwargs):
          adapted = validate(inspect.getcallargs(func, *args, **kwargs), adapt=True)
          argspec = inspect.getargspec(func)
          if argspec.varargs is argspec.keywords is None:
              return func(**adapted)
          adapted_varargs = adapted.pop(argspec.varargs, ())
          adapted_keywords = adapted.pop(argspec.keywords, {})
          if not adapted_varargs:
              if adapted_keywords:
                  adapted.update(adapted_keywords)
              return func(**adapted)
          adapted_posargs = [adapted[arg] for arg in argspec.args]
          adapted_posargs.extend(adapted_varargs)
          return func(*adapted_posargs, **adapted_keywords)
      return adapting