Added py2/3 compatibility for urllib