code: def pad(self, esp):
          
          # 2 extra bytes for padlen and nh
          data_len = len(esp.data) + 2
  
          # according to the RFC4303, section 2.4. Padding (for Encryption)
          # the size of the ESP payload must be a multiple of 32 bits
          align = _lcm(self.block_size, 4)
  
          # pad for block size
          esp.padlen = -data_len % align
  
          # padding must be an array of bytes starting from 1 to padlen
          esp.padding = ''
          for b in range(1, esp.padlen + 1):
              esp.padding += bytes([b])
  
          # If the following test fails, it means that this algo does not comply
          # with the RFC
          payload_len = len(esp.iv) + len(esp.data) + len(esp.padding) + 2
          if payload_len % 4 != 0:
              raise ValueError('The size of the ESP data is not aligned to 32 bits after padding.')
  
          return esp
docs: Add the correct amount of padding so that the data to encrypt is
          exactly a multiple of the algorithm's block size.
  
          Also, make sure that the total ESP packet length is a multiple of 4
          bytes.
  
          @param esp:    an unencrypted _ESPPlain packet
  
          @return:    an unencrypted _ESPPlain packet with valid padding