Modified to use Python 2.7 as 3.3 didn't appear to work, basic login and logout functionality in place.