import string
import random


def generate_key(length=50):
    """ Generate a random string

    Args:
        length: Number of characters in returned string (default = 50)

    Returns:
        Randomized secret key string
    """

    options = string.digits + string.ascii_letters + string.punctuation
    key = ''.join([random.choice(options) for i in range(length)])
    return key