Purification of single-walled carbon nanotubes