algorithms: Add user & password support to rewrite_url.
algorithms: Add encode_with_idna parameter to rewrite_url.
Remove code that should have never been committed.

Sorry for the accidental glimpse into the future for anyone that
may have noticed.
algorithms: Refactor rewrite_url.

Extracted _create_url_identifier and _normalize_host functions since
they will be handy in the future (for URL canonicalization) and it
reduces some of the unnecessary line noise.