docs: def ospf_lsa_checksum(lsa):
      """ Fletcher checksum for OSPF LSAs, returned as a 2 byte string.
  
      Give the whole LSA packet as argument.
      For details on the algorithm, see RFC 2328 chapter 12.1.7 and RFC 905 Annex B.
      """
      # This is based on the GPLed C implementation in Zebra <http://www.zebra.org/>
  
      CHKSUM_OFFSET = 16
  
      if len(lsa) < CHKSUM_OFFSET:
          raise Exception("LSA Packet too short (%s bytes)" % len(lsa))
  
      c0 = c1 = 0
      # Calculation is done with checksum set to zero
      lsa = lsa[:CHKSUM_OFFSET] + lsa[CHKSUM_OFFSET + 2:]
      for char in lsa[2:]:  #  leave out age
          c0 += char
          c1 += c0
  
      c0 %= 255
      c1 %= 255
  
      x = ((len(lsa) - CHKSUM_OFFSET - 1) * c0 - c1) % 255
  
      if (x <= 0):
          x += 255
  
      y = 510 - c0 - x
  
      if (y > 255):
          y -= 255
  
      checksum = (x << 8) + y
  
      return checksum