import random def id_gen(): string = 'ABCDEFGHIJKLMNOP1234567890' string = list(string) random.SystemRandom().shuffle(string) return ''.join(string)