from typing import Iterable


def as_path(key):
    """ Convert string to tuple of length 1 or other iterable to tuple. """

    if isinstance(key, str):
        return key,

    if isinstance(key, Iterable):
        return tuple(key)

    raise TypeError("bad key %r" % key)