<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _ensure_env(self, env: Union[jinja2.Environment, None]):
 """ Make sure the jinja environment is minimally configured. """

        if not env:
            env = jinja2.Environment()
        if not env.loader:
            env.loader = jinja2.FunctionLoader(lambda filename: self._cache[filename])
        if 'faker' not in env.globals:
            faker = Faker()
            faker.seed(1234)
            env.globals['faker'] = faker
        if 'random_model' not in env.globals:
            env.globals['random_model'] = jinja2.contextfunction(random_model)
        if 'random_models' not in env.globals:
            env.globals['random_models'] = jinja2.contextfunction(random_models)
        return env