def is_collection(obj):

    if isinstance(obj, basestring):
        return False

    return hasattr(obj, '__getitem__')
Tests if an object is a collection. Strings don't count.
dataset/ETHPy150Open kennethreitz/clint/clint/utils.py/is_collection