Works in a similar manner to `raises`, but for warnings instead
of exceptions. Also refactored `recwarn.py` so that all the
warning recording and checking use the same core code.
If the type is not checked then an incomprehensible error will occur
later. This enforces the type and raies the same exception/msg as
CPython does in that case.
Docstring unmodified, just re-justified for pep8 compat.