import string
import random


def generate_key(characters=string.ascii_letters + string.digits, length=20):
    """
    Generate random string with given characters and length.
    Args:
        characters: characters used for key generator.
        length: key length.

    Returns:
        generated random key.
    """
    return ''.join(random.choices(characters, k=length))