def is_iterator(obj):
    is_file = (PY2 and isinstance(obj, __builtin__.file))
    return (isinstance(obj, abc_iterator) and (not isinstance(obj, io.IOBase)) and (not is_file))
def is_iterator(obj):
    is_file = (PY2 and isinstance(obj, __builtin__.file))
    return (isinstance(obj, abc_iterator) and (not isinstance(obj, io.IOBase)) and (not is_file))