def _ensure_package(base, *parts):
    """Ensure that all the components of a module directory path exist, and
    contain a file __init__.py."""
    bits = []
    for bit in parts[:-1]:
        bits.append(bit)
        base.ensure(*(bits + ['__init__.py']))
    return base.ensure(*parts)