Router hashing: skip conversion if already string

If a value is already a string, do not try to pass it through the str()
function (since this will fail if the given value is a unicode string).