docs: def _get_bgp_route_attr(self, destination, vrf, next_hop, ip_version=4):
          """
          BGP protocol attributes for get_route_tp
          Only IPv4 supported
          """
  
          CMD_SHIBNV = 'show ip bgp neighbors vrf {vrf} | include "is {neigh}"'
  
          search_re_dict = {
              "aspath": {
                  "re": r"AS-Path: ([\d\(\)]([\d\(\) ])*)",
                  "group": 1,
                  "default": "",
              },
              "bgpnh": {
                  "re": r"[^|\\n][ ]{4}(" + IP_ADDR_REGEX + r")",
                  "group": 1,
                  "default": "",
              },
              "bgpfrom": {
                  "re": r"from (" + IP_ADDR_REGEX + r")",
                  "group": 1,
                  "default": "",
              },
              "bgpcomm": {
                  "re": r"  Community: ([\w\d\-\: ]+)",
                  "group": 1,
                  "default": "",
              },
              "bgplp": {"re": r"localpref (\d+)", "group": 1, "default": ""},
              # external, internal, redist
              "bgpie": {"re": r"^: (\w+),", "group": 1, "default": ""},
              "vrfimp": {
                  "re": r"Imported from [\S]+ \(VRF (\S+)\)",
                  "group": 1,
                  "default": "",
              },
          }
  
          bgp_attr = {}
          # get BGP AS number
          outbgp = self._send_command('show bgp process | include "BGP Protocol Tag"')
          matchbgpattr = RE_BGP_PROTO_TAG.match(outbgp)
          if not matchbgpattr:
              return bgp_attr
          bgpas = matchbgpattr.group(1)
          if ip_version == 4:
              bgpcmd = "show ip bgp vrf {vrf} {destination}".format(
                  vrf=vrf, destination=destination
              )
              outbgp = self._send_command(bgpcmd)
              outbgpsec = outbgp.split("Path type")
  
              # this should not happen (zero BGP paths)...
              if len(outbgpsec) == 1:
                  return bgp_attr
  
              # process all bgp paths
              for bgppath in outbgpsec[1:]:
                  if "is best path" not in bgppath:
                      # only best path is added to protocol attributes
                      continue
                  # find BGP attributes
                  for key in search_re_dict:
                      matchre = re.search(search_re_dict[key]["re"], bgppath)
                      if matchre:
                          groupnr = int(search_re_dict[key]["group"])
                          search_re_dict[key]["result"] = matchre.group(groupnr)
                      else:
                          search_re_dict[key]["result"] = search_re_dict[key]["default"]
                  bgpnh = search_re_dict["bgpnh"]["result"]
  
                  # if route is not leaked next hops have to match
                  if (
                      not (search_re_dict["bgpie"]["result"] in ["redist", "local"])
                  ) and (bgpnh != next_hop):
                      # this is not the right route
                      continue
                  # find remote AS nr. of this neighbor
                  bgpcmd = CMD_SHIBNV.format(vrf=vrf, neigh=bgpnh)
                  outbgpnei = self._send_command(bgpcmd)
                  matchbgpras = RE_BGP_REMOTE_AS.search(outbgpnei)
                  if matchbgpras:
                      bgpras = matchbgpras.group(1)
                  else:
                      # next-hop is not known in this vrf, route leaked from
                      #  other vrf or from vpnv4 table?
                      # get remote AS nr. from as-path if it is ebgp neighbor
                      # if locally sourced remote AS if undefined
                      bgpie = search_re_dict["bgpie"]["result"]
                      if bgpie == "external":
                          bgpras = bgpie.split(" ")[0].replace("(", "")
                      elif bgpie == "internal":
                          bgpras = bgpas
                      else:  # redist, local
                          bgpras = ""
                  # community
                  bothcomm = []
                  extcomm = []
                  stdcomm = search_re_dict["bgpcomm"]["result"].split()
                  commsplit = bgppath.split("Extcommunity:")
                  if len(commsplit) == 2:
                      for line in commsplit[1].split("\n")[1:]:
                          #          RT:65004:22
                          matchcommun = RE_BGP_COMMUN.match(line)
                          if matchcommun:
                              extcomm.append(matchcommun.group(1))
                          else:
                              # we've reached end of the extended community section
                              break
                  bothcomm = stdcomm + extcomm
                  bgp_attr = {
                      "as_path": search_re_dict["aspath"]["result"].strip(),
                      "remote_address": search_re_dict["bgpfrom"]["result"],
                      "local_preference": int(search_re_dict["bgplp"]["result"]),
                      "communities": bothcomm,
                      "local_as": helpers.as_number(bgpas),
                  }
                  if bgpras:
                      bgp_attr["remote_as"] = helpers.as_number(bgpras)
                  else:
                      bgp_attr["remote_as"] = 0  # 0? , locally sourced
          return bgp_attr