Make web2py's custom_import work with circular imports.

Ok, I believe this is how it should work.

The problem with original code that looks up `itemname` in `new_mod` is that in the case of circular import, `new_mod` won't have `itemname` because the original import that started the whole chain of imports hasn't finished yet.

For reference, previous attempt: https://github.com/web2py/web2py/pull/553