import random import string def genRandomStr(instance, N = 4): res = ''.join(random.choices(string.ascii_uppercase + string.digits, k=N)) return res