pyldb: Ensure that the ldb argument is really an ldb before we dereference