dpkg reports problems configuring huge list of python-related packages after any APT command

the root cause of your apt problems is python-lockfile, try to reinstall it with the following command:

sudo apt-get clean
sudo apt-get update
sudo apt-get install --reinstall python-minimal python-lockfile

EDIT:

You're running 13.10 (which reached its EOL), please update your repositories to install from old-releases.ubuntu.com, see How to install software or upgrade from an old unsupported release?.

You could also try to manually remove python-lockfile_1%3a0.8-2ubuntu1_all.deb from the cache and retry the above commands:

sudo rm "/var/cache/apt/archives/python-lockfile_1%3a0.8-2ubuntu1_all.deb"

The problem was that I was updating python in /usr/local/bin, but the actual installation is in /usr/bin/.