r2.13 cherry-pick: 2eae4850677 "Add TypeError catch (wrapt==1.15.0rc throws TypeError instead of AttributeError)."
Make sure to merge #60661 if this gets merged
Refer to the original commit: https://github.com/tensorflow/tensorflow/commit/2eae48506773587a7e74dd7064aa0fa9f0c37fbf