docs: def final(self,style='pkcs7'):
          # TODO: after calling final, reset the IV? so the cipher is as good as new?
          """Finalizes the encryption by padding the cache
  
              padfct = padding function
                       import from CryptoPlus.Util.padding
  
          For ECB, CBC: the remaining bytes in the cache will be padded and
                        encrypted.
          For OFB,CFB, CTR: an encrypted padding will be returned, making the
                            total outputed bytes since construction of the cipher
                            a multiple of the blocksize of that cipher.
  
          If the cipher has been used for decryption, the final function won't do
            anything. You have to manually unpad if necessary.
  
          After finalization, the chain can still be used but the IV, counter etc
            aren't reset but just continue as they were after the last step (finalization step).
          """
          assert self.mode not in (MODE_XTS, MODE_CMAC) # finalizing (=padding) doesn't make sense when in XTS or CMAC mode
          if self.ed == b'e':
              # when the chain is in encryption mode, finalizing will pad the cache and encrypt this last block
              if self.mode in (MODE_OFB,MODE_CFB,MODE_CTR):
                  dummy = b'0'*(self.chain.totalbytes%self.blocksize) # a dummy string that will be used to get a valid padding
              else: #ECB, CBC
                  dummy = self.chain.cache
              pdata = pad(dummy,self.blocksize,style=style)[len(dummy):]
              #~ pad = padfct(dummy,padding.PAD,self.blocksize)[len(dummy):] # construct the padding necessary
              return self.chain.update(pdata,b'e') # supply the padding to the update function => chain cache will be "cache+padding"
          else:
              # final function doesn't make sense when decrypting => padding should be removed manually
              pass