master_key = PBKDF2(password, salt, count=10000)

def my_rand(n):
    my_rand.counter += 1
return PBKDF2(master_key, 'my_rand:%d' % my_rand.counter, dkLen=n, count=1)
my_rand.counter = 0
RSA_key = RSA.generate(2048, randfunc=my_rand)
Making RSA keys from a password in python