how to check for an invalid tree item

There is an undocumented (as of the last distributed docs,
anyway), IsOk(). item.IsOk() (where item is the returned
tree item) returns true if it's good, false, otherwise.

I believe that, according to some discussions here on this
list a few weeks ago, the current CSV versions and future
releases will return an invalid item that evaluates to False,
so you can do:
    while item:

(i.e. valid items will all evaluate to true).

Al