def _env_vars_from_file(filename):
def split_env(env):<EOL><INDENT>if '<STR_LIT:=>' in env:<EOL><INDENT>return env.split('<STR_LIT:=>', <NUM_LIT:1>)<EOL><DEDENT>else:<EOL><INDENT>return env, None<EOL><DEDENT><DEDENT>env = {}<EOL>for line in open(filename, '<STR_LIT:r>'):<EOL><INDENT>line = line.strip()<EOL>if line and not line.startswith('<STR_LIT:#>'):<EOL><INDENT>k, v = split_env(line)<EOL>env[k] = v<EOL><DEDENT><DEDENT>return env<EOL>
This code is copied from Docker Compose, so that we're exactly compatible
with their `env_file` option