'Given a username, sign in the user.'

def sign_in(self, username):

    if (self.url == u'about:blank'):
        self.visit(u'/')
    token = user.uuid.uuid4().hex
    expires = (user.utcnow() + user.SESSION_TIMEOUT)
    P(username).update_session(token, expires)
    self.cookies.add({user.SESSION: token})
