'If the window is minimised or maximised, restore it.'

def AutoRestore(self):

    p = self.GetWindowPlacement()
    if ((p[1] == win32con.SW_MINIMIZE) or (p[1] == win32con.SW_SHOWMINIMIZED)):
        self.SetWindowPlacement(p[0], win32con.SW_RESTORE, p[2], p[3], p[4])
