import re


def parse_show_snmp_trap(raw_result):
    """
    Parse the 'show snmp trap' command raw output.

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

     ::

        {
            '20.2.2.2':{'Port':'455',
                       'Type':'inform',
                       'Version':'v2c',
                       'SecName':'testcom'
            },
            '10.1.1.1':{'Port':'162',
                       'Type':'trap',
                       'Version':'v1',
                       'SecName':'public'
            }
        }
    """
    pattern_found = 0
    result = []
    output = {}
    res = 0
    for line in raw_result.splitlines():
        if pattern_found == 2:
            result.append(line)
        else:
            res = re.match(r'\s*-+\s*', line)
            if res:
                pattern_found = pattern_found + 1
    for line in result:
        res = re.split(r'\s+', line)
        output[res[0]] = {'Port': res[1], 'Type': res[2], 'Version': res[3],
                          'SecName': res[4]}
    if output == {}:
        return None
    else:
        return output