All your subsequent problems are linked to this one :
dpkg: error processing python-kaa-base (--configure):
subprocess post-installation script returned error exit status 1
I would recommend getting rid of the buggy post-installation script and trying again. To do so identify the script with :
ls /var/lib/dpkg/info | grep python-kaa-base
this is going to return a list of post/pre install/rm for the package, cd to /var/lib/dpkg/info and rm or mv the relevant one (python-kaa-base.postinst probably) and try again.
To double check everything is in order do a dpkg -C
after that. (the rm/mv and dpkg commands need root privileges, be careful while using rm as root !)