sample python code of Chris Potts