<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def url_encode(url):
 """ Convert special characters using %xx escape. :param url: str :return: str - encoded url """

    if isinstance(url, text_type):
        url = url.encode('utf8')
    return quote(url, ':/%?&=')