Terrible and tiny Python-based socket monitoring