def CreateXsrfToken(action):
 user_str = _MakeUserStr()
 token = base64.b64encode(''.join((chr(int((random.random() * 255))) for _ in range(0, 64))))
 memcache.set(token, (user_str, action), time=XSRF_VALIDITY_TIME, namespace=MEMCACHE_NAMESPACE)
 return token

def CreateXsrfToken ( action ) : user_str = _MakeUserStr ( ) token = base64 . b64encode ( '' . join ( ( chr ( int ( ( random . random ( ) * 255 ) ) ) for _ in range ( 0 , 64 ) ) ) ) memcache . set ( token , ( user_str , action ) , time = XSRF_VALIDITY_TIME , namespace = MEMCACHE_NAMESPACE ) return token
generate a token to be passed with a form for xsrf protection .