<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def quoter(obj):
 """Return a Quoted URL. The quote function will return a URL encoded string. If there is an exception in the job which results in a "KeyError" the original string will be returned as it will be assumed to already be URL encoded. :param obj: ``basestring`` :return: ``str`` """


    try:
        try:
            return urllib.quote(obj)
        except AttributeError:
            return urllib.parse.quote(obj)
    except KeyError:
        return obj