from typing import Iterable
from typing import Tuple
from typing import Any


def validate_iterable(item: Iterable, types: tuple) -> Tuple[int, Any]:
    """
    Validates iterable items
    :returns: (int - status code;
               Any - invalid item, None otherwise)
    Status codes:
    0 - success
    1 - type error
    """
    if not isinstance(item, Iterable):
        return 1, item

    for v in item:
        if not isinstance(v, types):
            return 1, v

        if not isinstance(v, str) and isinstance(v, Iterable):
            iter_v_res, iter_v_res_item = validate_iterable(v, types)
            if iter_v_res > 0:
                return iter_v_res, iter_v_res_item

    return 0, None