'Make sure \'pythonw\' is used for gui and and \'python\' is used for
console (regardless of what sys.executable is).'

@staticmethod
def _adjust_header(type_, orig_header):

    pattern = 'pythonw.exe'
    repl = 'python.exe'
    if (type_ == 'gui'):
        (pattern, repl) = (repl, pattern)
    pattern_ob = re.compile(re.escape(pattern), re.IGNORECASE)
    new_header = pattern_ob.sub(string=orig_header, repl=repl)
    clean_header = new_header[2:(-1)].strip('"')
    if ((sys.platform == 'win32') and (not os.path.exists(clean_header))):
        return orig_header
    return new_header
