Improve idempotence of uri_to_iri and iri_to_uri

Add tests for the idempotence of uri_to_iri and iri_to_uri. Making
these pass requires making some possibly contentious changes to the way
these functions work.

In particular the assumption that a URI is always a str and an IRI is
always a unicode is removed and some things are put in place to allow
everything to still work.

I'm opening this pull request more to encourage discussion as to where this
is right and where it's wrong so that we can make it more right. =)