ENH: Backport assert_in

@almarklein ready for review. We might eventually want/need a `util/fixes.py` or so to collect these things, but I figured for now `misc.py` is an okay place.