The fix to the headphone/speaker sound problem (appending an option to /etc/modprobe.d/alsa-base.conf) didn't work for me. I made a work-around:

#! /usr/bin/env python
# sound fix

import...