def generate_key(length): return ''.join(random.choice(string.ascii_letters + string.digits) for _ in range(length))