import secrets


def generate_password(character_set, length):
    """
    Uses the secretes module to pick a given number of characters
    from the available character set. https://docs.python.org/3/library/secrets.html
    """
    # "complexity is the worst enemy of security" - Bruce Schneier.
    return ''.join(secrets.choice(character_set) for _character in range(length))