def preprocess_args(preprocess_func, varnames):
    """Applies preprocess_func to variables in varnames before launching
    the function.
    """

    def decor(func):
        argnames = inspect.getfullargspec(func).args

        def wrapper(func, *args, **kwargs):
            new_args = [
                (
                    preprocess_func(arg)
                    if (name in varnames) and (arg is not None)
                    else arg
                )
                for (arg, name) in zip(args, argnames)
            ]
            new_kwargs = {
                kwarg: preprocess_func(value) if kwarg in varnames else value
                for (kwarg, value) in kwargs.items()
            }
            return func(*new_args, **new_kwargs)

        return decorator.decorate(func, wrapper)

    return decor
Applies preprocess_func to variables in varnames before launching
    the function.
    
moviepy/decorators.py