<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def bgp_summary_parser(bgp_summary):
 """Parse 'show bgp all summary vrf' output information from NX-OS devices."""


    bgp_summary_dict = {}
    # Check for BGP summary information lines that have no data
    if len(bgp_summary.strip().splitlines()) <= 1:
        return {}

    allowed_afi = ["ipv4", "ipv6", "l2vpn"]
    vrf_regex = r"^BGP summary information for VRF\s+(?P<vrf>\S+),"
    afi_regex = (
        r"^BGP summary information.*address family (?P<afi>\S+ (?:Unicast|EVPN))"
    )
    local_router_regex = (
        r"^BGP router identifier\s+(?P<router_id>\S+)"
        r",\s+local AS number\s+(?P<local_as>\S+)"
    )

    for pattern in [vrf_regex, afi_regex, local_router_regex]:
        match = re.search(pattern, bgp_summary, flags=re.M)
        if match:
            bgp_summary_dict.update(match.groupdict(1))

    # Some post regex cleanup and validation
    vrf = bgp_summary_dict["vrf"]
    if vrf.lower() == "default":
        bgp_summary_dict["vrf"] = "global"

    afi = bgp_summary_dict["afi"]
    afi = afi.split()[0].lower()
    if afi not in allowed_afi:
        raise ValueError("AFI ({}) is invalid and not supported.".format(afi))
    bgp_summary_dict["afi"] = afi

    local_as = bgp_summary_dict["local_as"]
    local_as = helpers.as_number(local_as)

    match = re.search(IPV4_ADDR_REGEX, bgp_summary_dict["router_id"])
    if not match:
        raise ValueError(
            "BGP router_id ({}) is not valid".format(bgp_summary_dict["router_id"])
        )

    vrf = bgp_summary_dict["vrf"]
    bgp_return_dict = {vrf: {"router_id": bgp_summary_dict["router_id"], "peers": {}}}

    # Extract and process the tabular data
    tabular_divider = r"^Neighbor\s+.*PfxRcd$"
    tabular_data = re.split(tabular_divider, bgp_summary, flags=re.M)
    if len(tabular_data) != 2:
        msg = "Unexpected data processing BGP summary information:\n\n{}".format(
            bgp_summary
        )
        raise ValueError(msg)
    tabular_data = tabular_data[1]
    bgp_table = bgp_normalize_table_data(tabular_data)
    for bgp_entry in bgp_table_parser(bgp_table):
        bgp_return_dict[vrf]["peers"].update(bgp_entry)

    bgp_new_dict = {}
    for neighbor, bgp_data in bgp_return_dict[vrf]["peers"].items():
        received_prefixes = bgp_data.pop("received_prefixes")
        bgp_data["address_family"] = {}
        prefixes_dict = {
            "sent_prefixes": -1,
            "accepted_prefixes": -1,
            "received_prefixes": received_prefixes,
        }
        bgp_data["address_family"][afi] = prefixes_dict
        bgp_data["local_as"] = local_as
        # FIX, hard-coding
        bgp_data["remote_id"] = "0.0.0.0"
        bgp_new_dict[neighbor] = bgp_data

    bgp_return_dict[vrf]["peers"] = bgp_new_dict

    return bgp_return_dict