I fail to see how "container or list or array" characterises what the code above checked for.  We iterated an array looking for scalars and lists, ignoring everything else.