def env_validator(passed_kwargs, merged_kwargs):
    """ a validator to check that env is a dictionary and that all environment variable 
    keys and values are strings. Otherwise, we would exit with a confusing exit code 255. """
    invalid = []
    env = passed_kwargs.get('env', None)
    if env is None:
        return invalid
    if not isinstance(env, dict):
        invalid.append(('env', 'env must be a dict. Got {!r}'.format(env)))
        return invalid
    for k, v in passed_kwargs['env'].items():
        if not isinstance(k, str):
            invalid.append(('env', 'env key {!r} must be a str'.format(k)))
        if not isinstance(v, str):
            invalid.append(('env',
                'value {!r} of env key {!r} must be a str'.format(v, k)))
    return invalid
