<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_article_url(self, resolve_doi=True):
 """ If record has a DOI, set article URL based on where the DOI points. """

        if 'DOI' in self.record:
            doi_url = "/".join(['http://dx.doi.org', self.record['DOI']])

            if resolve_doi:
                try:
                    response = urlopen(doi_url)
                except URLError:
                    self.url = ''
                else:
                    self.url = response.geturl()
            else:
                self.url = doi_url

        else:
            self.url = ''