<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _parse_ip_addr_show(raw_result):
 """ Parse the 'ip addr list dev' command raw output. :param str raw_result: os raw result string. :rtype: dict :return: The parsed result of the show interface command in a \ dictionary of the form: :: { 'os_index' : '0', 'dev' : 'eth0', 'falgs_str': 'BROADCAST,MULTICAST,UP,LOWER_UP', 'mtu': 1500, 'state': 'down', 'link_type' 'ether', 'mac_address': '00:50:56:01:2e:f6', 'inet': '20.1.1.2', 'inet_mask': '24', 'inet6': 'fe80::42:acff:fe11:2', 'inte6_mask': '64' } """

    # does link exist?
    show_re = (
        r'"(?P<dev>\S+)"\s+does not exist'
    )
    re_result = search(show_re, raw_result)
    result = None

    if not (re_result):
        # match top two lines for serveral 'always there' variables
        show_re = (
            r'\s*(?P<os_index>\d+):\s+(?P<dev>\S+):\s+<(?P<falgs_str>.*)?>.*?'
            r'mtu\s+(?P<mtu>\d+).+?state\s+(?P<state>\w+).*'
            r'\s*link/(?P<link_type>\w+)\s+(?P<mac_address>\S+)'
        )

        re_result = search(show_re, raw_result, DOTALL)
        result = re_result.groupdict()

        # seek inet if its there
        show_re = (
                r'((inet )\s*(?P<inet>[^/]+)/(?P<inet_mask>\d{1,2}))'
            )
        re_result = search(show_re, raw_result)
        if (re_result):
            result.update(re_result.groupdict())

        # seek inet6 if its there
        show_re = (
                r'((?<=inet6 )(?P<inet6>[^/]+)/(?P<inet6_mask>\d{1,2}))'
            )
        re_result = search(show_re, raw_result)
        if (re_result):
            result.update(re_result.groupdict())

        # cleanup dictionary before returning
        for key, value in result.items():
            if value is not None:
                if value.isdigit():
                    result[key] = int(value)

    return result