def is_iterable(x):
    try:
        iter(x)
    except TypeError:
        return False
    else:
        return True
A implementation independent way of checking for iterables
dataset/ETHPy150Open django/django/django/utils/itercompat.py/is_iterable