from typing import Optional
from typing import Iterator


def safe_iter(obj) -> Optional[Iterator]:
    """
    Returns an iterator for the object if it's iterable,
    or None if it's not.

    :param obj:     The object to get the iterator for.
    :return:        The iterator, or None if it's not iterable.
    """
    try:
        return iter(obj)
    except Exception:
        return None