From http://stackoverflow.com/questions/2257441/python-random-string-generation-with-upper-case-letters-and-digits