def generate_token(length=30, chars=UNICODE_ASCII_CHARACTER_SET):
 rand = random.SystemRandom()
 return u''.join((rand.choice(chars) for x in range(length)))

def generate_token ( length = 30 , chars = UNICODE_ASCII_CHARACTER_SET ) : rand = random . SystemRandom ( ) return u'' . join ( ( rand . choice ( chars ) for x in range ( length ) ) )
generates a non-guessable oauth token oauth does not specify the format of tokens except that they should be strings of random characters .