docs: def _in6_getifaddr(ifname):
      """
      Returns a list of IPv6 addresses configured on the interface ifname.
      """
  
      # Get the output of ifconfig
      try:
          f = os.popen("%s %s" % (conf.prog.ifconfig, ifname))
      except OSError:
          log_interactive.warning("Failed to execute ifconfig.")
          return []
  
      # Iterate over lines and extract IPv6 addresses
      ret = []
      for line in f:
          if "inet6" in line:
              addr = line.rstrip().split(None, 2)[1]  # The second element is the IPv6 address  # noqa: E501
          else:
              continue
          if '%' in line:  # Remove the interface identifier if present
              addr = addr.split("%", 1)[0]
  
          # Check if it is a valid IPv6 address
          try:
              inet_pton(socket.AF_INET6, addr)
          except (socket.error, ValueError):
              continue
  
          # Get the scope and keep the address
          scope = in6_getscope(addr)
          ret.append((addr, scope, ifname))
  
      return ret