def script_init(self, lease, state, prefix='<STR_LIT>', medium='<STR_LIT>'):
logger.debug('<STR_LIT>', self.scriptname)<EOL>if self.scriptname is not None:<EOL><INDENT>logger.debug('<STR_LIT>')<EOL>if isinstance(state, int):<EOL><INDENT>reason = STATES2REASONS[state]<EOL><DEDENT>else:<EOL><INDENT>reason = state<EOL><DEDENT>self.env['<STR_LIT>'] = str(reason)<EOL>self.env['<STR_LIT>'] = self.env.get('<STR_LIT>') or str(medium)<EOL>self.env['<STR_LIT>'] = str('<STR_LIT>')<EOL>self.env['<STR_LIT>'] = str(os.getpid())<EOL>for k in LEASEATTRS_SAMEAS_ENVKEYS:<EOL><INDENT>self.env[k] = str(lease.__getattribute__(k))<EOL><DEDENT>for k, v in LEASEATTRS2ENVKEYS.items():<EOL><INDENT>self.env[v] = str(lease.__getattribute__(k))<EOL><DEDENT>self.env.update(ENV_OPTIONS_REQ)<EOL><DEDENT>else:<EOL><INDENT>logger.debug('<STR_LIT>')<EOL><DEDENT>
Initialize environment to pass to the external script.