from typing import Iterable
from typing import Union


def join_digits(digits: Iterable[Union[int, str]], base: int = 10) -> int:
    """Forms an integer from a sequence of digits in a given base.

    Args:
        digits: An iterable sequence of digits, which can be either integers or
            characters, from most to least significant.
        base: The base representation of the resulting number. Must be at least
            2.

    Returns:
        An integer value whose digits (from most to least significant) are
        given by ``digits`` when written in the given base.
    """
    return int(''.join(map(str, digits)), base)