def iteritems(obj, **kwargs):
    """Iterate over dict items in Python 2 & 3."""
    return (obj.iteritems(**kwargs) 
            if hasattr(obj, 'iteritems') 
            else iter(obj.items(**kwargs)))