<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def replace_local_hyperlinks( text, base_url="https://github.com/project-rig/rig/blob/master/"):
 """Replace local hyperlinks in RST with absolute addresses using the given base URL. This is used to make links in the long description function correctly outside of the repository (e.g. when published on PyPi). NOTE: This may need adjusting if further syntax is used. """

    def get_new_url(url):
        return base_url + url[2:]

    # Deal with anonymous URLS
    for match in re.finditer(r"^__ (?P<url>\./.*)", text, re.MULTILINE):
        orig_url = match.groupdict()["url"]
        url = get_new_url(orig_url)

        text = re.sub("^__ {}".format(orig_url),
                      "__ {}".format(url), text, flags=re.MULTILINE)

    # Deal with named URLS
    for match in re.finditer(r"^\.\. _(?P<identifier>[^:]*): (?P<url>\./.*)",
                             text, re.MULTILINE):
        identifier = match.groupdict()["identifier"]
        orig_url = match.groupdict()["url"]
        url = get_new_url(orig_url)

        text = re.sub(
            "^\.\. _{}: {}".format(identifier, orig_url),
            ".. _{}: {}".format(identifier, url),
            text, flags=re.MULTILINE)

    # Deal with image URLS
    for match in re.finditer(r"^\.\. image:: (?P<url>\./.*)",
                             text, re.MULTILINE):
        orig_url = match.groupdict()["url"]
        url = get_new_url(orig_url)

        text = text.replace(".. image:: {}".format(orig_url),
                            ".. image:: {}".format(url))

    return text