import itertools


def iter_extend(iterable, length, obj=None):
    """Ensure that iterable is the specified length by extending with obj"""
    return itertools.islice(itertools.chain(iterable, itertools.repeat(obj)), length)