docs: def get_ipv6_addr(iface=None, inc_aliases=False, fatal=True, exc_list=None,
                    dynamic_only=True):
      """Get assigned IPv6 address for a given interface.
  
      Returns list of addresses found. If no address found, returns empty list.
  
      If iface is None, we infer the current primary interface by doing a reverse
      lookup on the unit private-address.
  
      We currently only support scope global IPv6 addresses i.e. non-temporary
      addresses. If no global IPv6 address is found, return the first one found
      in the ipv6 address list.
  
      :param iface: network interface on which ipv6 address(es) are expected to
                    be found.
      :param inc_aliases: include alias interfaces in search
      :param fatal: if True, raise exception if address not found
      :param exc_list: list of addresses to ignore
      :param dynamic_only: only recognise dynamic addresses
      :return: list of ipv6 addresses
      """
      addresses = get_iface_addr(iface=iface, inet_type='AF_INET6',
                                 inc_aliases=inc_aliases, fatal=fatal,
                                 exc_list=exc_list)
  
      if addresses:
          global_addrs = []
          for addr in addresses:
              key_scope_link_local = re.compile("^fe80::..(.+)%(.+)")
              m = re.match(key_scope_link_local, addr)
              if m:
                  eui_64_mac = m.group(1)
                  iface = m.group(2)
              else:
                  global_addrs.append(addr)
  
          if global_addrs:
              # Make sure any found global addresses are not temporary
              cmd = ['ip', 'addr', 'show', iface]
              out = subprocess.check_output(cmd).decode('UTF-8')
              if dynamic_only:
                  key = re.compile("inet6 (.+)/[0-9]+ scope global.* dynamic.*")
              else:
                  key = re.compile("inet6 (.+)/[0-9]+ scope global.*")
  
              addrs = []
              for line in out.split('\n'):
                  line = line.strip()
                  m = re.match(key, line)
                  if m and 'temporary' not in line:
                      # Return the first valid address we find
                      for addr in global_addrs:
                          if m.group(1) == addr:
                              if not dynamic_only or \
                                      m.group(1).endswith(eui_64_mac):
                                  addrs.append(addr)
  
              if addrs:
                  return addrs
  
      if fatal:
          raise Exception("Interface '%s' does not have a scope global "
                          "non-temporary ipv6 address." % iface)
  
      return []