def is_container(item):
 if isinstance(item, str):
  return False
 elif hasattr(item, u'__iter__'):
  return True
 else:
  return False

def is_container ( item ) : if isinstance ( item , str ) : return False elif hasattr ( item , u'__iter__' ) : return True else : return False
test if an object is a container but not a string .