docs: def encryptfile(filename, key=None, outfile=None, chunk=64 * 1024):
      """
      Encrypts a file using AES (CBC mode) with the given key.  If no
      file is supplied, then the inputted file will be modified in place.
      The chunk value will be the size with which the function uses to
      read and encrypt the file.  Larger chunks can be faster for some files
      and machines.  The chunk MUST be divisible by 16.
      
      :param      text    | <str>
                  key     | <str>
                  outfile | <str> || None
                  chunk   | <int>
      """
      if key is None:
          key = ENCRYPT_KEY
  
      if not outfile:
          outfile = filename + '.enc'
  
      iv = Random.new().read(16)
      cipher = AES.new(key, AES.MODE_CBC, iv)
      filesize = os.path.getsize(filename)
  
      with open(filename, 'rb') as input:
          with open(outfile, 'wb') as output:
              output.write(struct.pack('<Q', filesize))
              output.write(iv)
  
              while True:
                  data = input.read(chunk)
                  if len(data) == 0:
                      break
  
                  data = pad(data, len(key))
                  output.write(cipher.encrypt(data))