import itertools


def nth_item(iterable, n, default=None):
    """
    Returns the nth item of an iterable or a default value.

    Support Python-style negative indexing.
    """
    if n < 0:
        l = list(iterable)
        try:
            return l[n]
        except IndexError:
            return default
    else:
        return next(itertools.islice(iterable, n, None), default)