Changing None to empty string for urlunparse().
Fixed inconsistent white space
Fixed urllib imports and unicode encoding attempt.