<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def setUrl(self, url):
 """ Attempt to safely set the URL by string. """

        if isUrl(url):
            self._url = url
        else:
            raise exceptions.BadUrlException(url)
        return self