Check out `.partition` for doing this kind of work.