def generate_sequence(set_chars, set_length, iteration=0):
    """
    Generates a set length sequence of characters from an input character set
    based on an input iteration.

    Args:
        set_chars (str): input character set to construct further sets from.
        set_length (int): length of the character set to output and generate.
        iteration (int): current iteration of the construction algorithm.

    Returns:
        The generated character sequence.
    """

    s = ""  # Current selection from the input character set.

    # Number of characters in the character set.
    charcount = len(set_chars)

    # Iterate over the desired length of the output combination and generate the combination.
    for i in range(0, set_length):
        char = set_chars[int((iteration / pow(charcount, set_length - i - 1)) % charcount)]
        if char is not " ":
            s = s + char

    return s