from typing import List
from typing import Union
from typing import cast


def concat_tokens(tokens: List[Union[str, bool]]) -> str:
    """Concatenate the tokens in the output list.

    Parameters
    ----------
    tokens: list
        List of string and boolean values

    Returns
    -------
    string
    """
    if len(tokens) > 0:
        result = cast(str, tokens[0])
        index = 1
        while index < len(tokens) - 1:
            if cast(bool, tokens[index]):
                result += ' '
            index += 1
            result += cast(str, tokens[index])
            index += 1
        return result
    else:
        return ''