'Set and return the default CrayPE target loaded in a clean login
session.
A bash subshell is launched with a wiped environment and the list of
loaded modules is parsed for the first acceptable CrayPE target.'

def _default_target_from_env(self):

    if (getattr(self, 'default', None) is None):
        env = which('env')
        env.add_default_arg('-')
        output = env(('USER=%s' % os.environ['USER']), ('HOME=%s' % os.environ['HOME']), '/bin/bash', '--noprofile', '--norc', '-c', '.    /etc/profile;    module    list    -lt', output=str, error=str)
        self._defmods = _get_modules_in_modulecmd_output(output)
        targets = []
        _fill_craype_targets_from_modules(targets, self._defmods)
        self.default = (targets[0] if targets else None)
        tty.debug('Found    default    modules:', *[('                    %s' % mod) for mod in self._defmods])
    return self.default
