import re


def parse_show_vrrp_interface(raw_result):
    """
    Parse the 'show vrrp interface' command raw output.

    :param str raw_result: vtysh raw result string.
    :rtype: dict
    :return: The parsed result of the show vrrp interface command in a \
        dictionary of the form:

     ::

       {
            'master_adv_interval': '1000 msec (expires in 11 msec)',
            'group': '1',
            'address_family': 'IPv4',
            'track_obj': None,
            'master_router': '10.0.0.2 (local), priority is 100',
            'priority': '100',
            'down_interval': 'unknown',
            'state': 'MASTER',
            'advertisement_interval': '1000 msec',
            'virtual_secondary_ip_address': None,
            'version': ' 3',
            'mac_address': '0000.5e00.0101',
            'virtual_ip_address': '10.0.0.1',
            'state_dur': '11 mins 21.617 secs',
            'premption': 'enabled',
            'interface': '1'
       }
    """

    show_re = (

     r'Interface (?P<interface>.*) - Group (?P<group>\d+) -' +
     ' Address-Family (?P<address_family>\S+)\s*'
     r'State is (?P<state>.*)\n+\s*'
     r'State duration (?P<state_dur>.*)\n+\s*'
     r'Virtual IP address is (?P<virtual_ip_address>.*)\n+\s*'
     r'(Virtual secondary IP addresses:)?\s*'
     r'((?P<virtual_secondary_ip_address>[0-9a-f:]+)?)?\s*'
     r'(Virtual MAC address is (?P<mac_address>.*)\n+)?\s*'
     r'(Advertisement interval is (?P<advertisement_interval>.*)\n+)?\s*'
     r'(Version(?P<version>.*))?\s*'
     r'Preemption (?P<premption>\S+)\s*'
     r'Priority is (?P<priority>\d+)\s*'
     r'(Master Router is (?P<master_router>.*))?\s*'
     r'(Master Advertisement interval is (?P<master_adv_interval>.*))\s*'
     r'(Master Down interval is (?P<down_interval>.*)\n+)?\s*'
     r'(Tracked object id is (?P<track_obj>.*)\n+)?\s*'

    )
    re_result = re.search(show_re, raw_result)
    assert re_result

    result = re_result.groupdict()
    return result