<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def links(res: requests.models.Response, search: str = None, pattern: str = None) -> list: """Get the links of the page. Args: res (requests.models.Response):
 The response of the page. search (str, optional):
 Defaults to None. Search the links you want. pattern (str, optional):
 Defaults to None. Search the links use a regex pattern. Returns: list: All the links of the page. """

    hrefs = [link.to_text() for link in find_all_links(res.text)]
    if search:
        hrefs = [href for href in hrefs if search in href]
    if pattern:
        hrefs = [href for href in hrefs if re.findall(pattern, href)]
    return list(set(hrefs))