Instead of checking for list type, check for collections.Iterable type.