def collapse(bitdef):
    """
    Collapse undefined bits into real bits to make new bitdefs.

    The undefined bits are expanded in order, from left to right, with 0
    first, then 1.

    For example, ``10.0.`` becomes:

    - ``10000``
    - ``10001``
    - ``10100``
    - ``10101``

    Args:
        bitdef(str): The bitdef to collapse.
    Returns:
        list(str): The list of bitdefs the original bitdef has collapsed
        to.
    """

    if "." in bitdef:
        res = collapse(bitdef.replace(".", "0", 1))
        res.extend(collapse(bitdef.replace(".", "1", 1)))
    else:
        res = [bitdef]

    return res