from typing import Iterable
from typing import Iterator


def _get_iterator(iterable: Iterable) -> Iterator:
    """Returns appropriate iterator for the given iterable.
    If iterable is already an iterator, it is returned as is.
    """

    if isinstance(iterable, dict):
        # since iter(dict) returns a tuple of keys.
        # I want a tuple of key-value pairs
        return iter(iterable.items())

    elif not isinstance(iterable, Iterator):
        return iter(iterable)

    else:  # if iterable is already an iterator
        return iterable