Added docs for topports.
Added tests and code for topips function.