Port combinate

Add docs, tests and move the code from cogent.

---------

I sorted the function names in the misc module docstrings to be in alphabetical order.