What is the most lightweight way to create a random string of 30 characters like the following?

ufhy3skj5nca0d2dfh9hwd2tbk9sw1

And an hexadecimal number of 30 digits like the followin?

8c6f78ac23b4a7b8c0182d7a89e9b1
Note: random.choice(string.hexdigits) is incorrect, because string.hexdigits returns 0123456789abcdefABCDEF (both lowercase and uppercase), so you will get a biased result, with the hex digit 'c' twice as likely to appear as the digit '7'. Instead, just use random.choice('0123456789abcdef').
Most lightweight way to create a random string and a random hexadecimal number