<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def discover(url, timeout=None):
 """Discover the hub url and topic url of a given url. Firstly, by inspecting the page's headers, secondarily by inspecting the content for link tags. timeout determines how long to wait for the url to load. It defaults to 3. """

    resp = get_content({'REQUEST_TIMEOUT': timeout}, url)

    parser = LinkParser()
    parser.hub_url = (resp.links.get('hub') or {}).get('url')
    parser.topic_url = (resp.links.get('self') or {}).get('url')
    try:
        parser.updated()
        for chunk in resp.iter_content(chunk_size=None, decode_unicode=True):
            parser.feed(chunk)
        parser.close()
    except Finished:
        return {'hub_url': parser.hub_url, 'topic_url': parser.topic_url}

    raise DiscoveryError("Could not find hub url in topic page")