<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def expand_url(status):
 """Expand url on statuses. :param status: A tweepy status to expand urls. :type status: :class:`tweepy.models.Status` :returns: A string with expanded urls. :rtype: :class:`str` """


    try:
        txt = get_full_text(status)
        for url in status.entities['urls']:
            txt = txt.replace(url['url'], url['expanded_url'])
    except:
        # Manually replace
        txt = status
        tco_pattern = re.compile(r'https://t.co/\S+')
        urls = tco_pattern.findall(txt)
        for url in urls:
            with urlopen(url) as resp:
                expanded_url = resp.url
            txt = txt.replace(url, expanded_url)

    return txt