def rndstr(size=16, alphabet=''):
 rng = random.SystemRandom()
 if (not alphabet):
  alphabet = (string.letters[0:52] + string.digits)
 return str().join((rng.choice(alphabet) for _ in range(size)))

def rndstr ( size = 16 , alphabet = '' ) : rng = random . SystemRandom ( ) if ( not alphabet ) : alphabet = ( string . letters [ 0 : 52 ] + string . digits ) return str ( ) . join ( ( rng . choice ( alphabet ) for _ in range ( size ) ) )
returns a string of random ascii characters or digits .