Python register and login code