def nth(iterable, n, default=None):
    "Returns the nth item or a default value"
    return next(itertools.islice(iterable, n, None), default)
Returns the nth item or a default value
recipes/Python/578033_Find_Path_to_Object/recipe-578033.py