def generate_api_key():
 seed = os.urandom(256)
 hashed_seed = hashlib.sha256(seed).hexdigest()
 return base64.b64encode(hashed_seed, random.choice(['rA', 'aZ', 'gQ', 'hH', 'hG', 'aR', 'DD'])).rstrip('==')

def generate_api_key ( ) : seed = os . urandom ( 256 ) hashed_seed = hashlib . sha256 ( seed ) . hexdigest ( ) return base64 . b64encode ( hashed_seed , random . choice ( [ 'rA' , 'aZ' , 'gQ' , 'hH' , 'hG' , 'aR' , 'DD' ] ) ) . rstrip ( '==' )
generates an sufficiently large and random key .