This is probably one of the shortest and simplest implementations I've seen in any language. Nice work MasterPi !
import string
import random
"".join([random.choice(string.letters+string.digits) for x in range(1, desired_length)])
[ Source ]