diff --git a/IPython/html/utils.py b/IPython/html/utils.py
index 7748de9..0ea9265 100644
--- a/IPython/html/utils.py
+++ b/IPython/html/utils.py
@@ -13,7 +13,10 @@ Authors:
#-----------------------------------------------------------------------------
import os
-from urllib import quote, unquote
+try:
+ from urllib.parse import quote, unquote
+except ImportError:
+ from urllib import quote, unquote
from IPython.utils import py3compat