from typing import List


def depth_items(list_: List, d: int) -> int:
    """
    Return the number of elements of <list_> that are
    at depth <d>.

    Precondition: Cannot have depth of 0 (i.e. d = 0)

    >>> depth_items([1, [2, [3]]], 2)
    2
    >>> depth_items([1, [2, 3, 4, 5, 6, [3, 4, 5]]], 2)
    6
    >>> depth_items([1, [2, 3, 4, 5, 6, [3, 4, 5]]], 3)
    3
    >>> depth_items([1, [2, [3]]], 1)
    2
    >>> list_ = [0, 1]
    >>> depth_items(list_, 1)
    2
    >>> list_ = [[0, 1], 2, [3, [[], 4]]]
    >>> depth_items(list_, 2)
    4
    >>> # 4 elements: 0, 1, 3, [[] , 4]
    """
    if d == 0:
        return 1
    elif not isinstance(list_, list):
        return 0
    else:
        return sum(depth_items(s, d - 1) for s in list_)

    # Solution to match below:
    # if d <= 0:
    #     return 0
    # elif d == 1:
    #     return 1
    # elif not isinstance(list_, list):
    #     return 0
    # else:
    #     return sum(depth_items(s, d - 1) for s in list_)