Fix exception in unknown commands that contain capital letters.

Fixes #1561. Removes an erroneous call to .lower() and adds regression tests.

This is my second contribution to PIP, any and all feedback is welcome.