def _shell_prelude(self, environment=None, modules=None):
environment = environment or {}<EOL>modules = modules or []<EOL>ostr = six.StringIO()<EOL>print('<STR_LIT>', file=ostr)<EOL>print(file=ostr)<EOL>print('<STR_LIT>', file=ostr)<EOL>print('<STR_LIT>', file=ostr)<EOL>for module in modules:<EOL><INDENT>print('<STR_LIT>' + module, file=ostr)<EOL><DEDENT>if modules:<EOL><INDENT>print('<STR_LIT>', file=ostr)<EOL>for module in modules:<EOL><INDENT>print(<EOL>'<STR_LIT>'.format(module),<EOL>file=ostr,<EOL>)<EOL><DEDENT><DEDENT>print('<STR_LIT>', file=ostr)<EOL>for name, value in environment.items():<EOL><INDENT>value = six.moves.shlex_quote(value)<EOL>print('<STR_LIT>', name + "<STR_LIT:=>" + value, file=ostr)<EOL><DEDENT>with contextlib.closing(ostr):<EOL><INDENT>return ostr.getvalue()<EOL><DEDENT>
Rebuild shell-script prelude to ensure that
        both environment variables and modules are properly
        set.