REF: simplify logic in assert_produces_warning
- [ ] closes #xxxx
- [ ] tests added / passed
- [ ] passes `black pandas`
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry

Simplified logic in ``assert_produces_warning`` by extracting functions ``_assert_caught_expected_warning``, ``_assert_caught_no_extra_warnings`` and ``_is_unexpected_warning``.