docs: def in6_getLinkScopedMcastAddr(addr, grpid=None, scope=2):
      """
      Generate a Link-Scoped Multicast Address as described in RFC 4489.
      Returned value is in printable notation.
  
      'addr' parameter specifies the link-local address to use for generating
      Link-scoped multicast address IID.
  
      By default, the function returns a ::/96 prefix (aka last 32 bits of
      returned address are null). If a group id is provided through 'grpid'
      parameter, last 32 bits of the address are set to that value (accepted
      formats : b'\x12\x34\x56\x78' or '12345678' or 0x12345678 or 305419896).
  
      By default, generated address scope is Link-Local (2). That value can
      be modified by passing a specific 'scope' value as an argument of the
      function. RFC 4489 only authorizes scope values <= 2. Enforcement
      is performed by the function (None will be returned).
  
      If no link-local address can be used to generate the Link-Scoped IPv6
      Multicast address, or if another error occurs, None is returned.
      """
      if scope not in [0, 1, 2]:
          return None
      try:
          if not in6_islladdr(addr):
              return None
          addr = inet_pton(socket.AF_INET6, addr)
      except Exception:
          warning("in6_getLinkScopedMcastPrefix(): Invalid address provided")
          return None
  
      iid = addr[8:]
  
      if grpid is None:
          grpid = b'\x00\x00\x00\x00'
      else:
          if isinstance(grpid, (bytes, str)):
              if len(grpid) == 8:
                  try:
                      grpid = int(grpid, 16) & 0xffffffff
                  except Exception:
                      warning("in6_getLinkScopedMcastPrefix(): Invalid group id provided")  # noqa: E501
                      return None
              elif len(grpid) == 4:
                  try:
                      grpid = struct.unpack("!I", grpid)[0]
                  except Exception:
                      warning("in6_getLinkScopedMcastPrefix(): Invalid group id provided")  # noqa: E501
                      return None
          grpid = struct.pack("!I", grpid)
  
      flgscope = struct.pack("B", 0xff & ((0x3 << 4) | scope))
      plen = b'\xff'
      res = b'\x00'
      a = b'\xff' + flgscope + res + plen + iid + grpid
  
      return inet_ntop(socket.AF_INET6, a)