some python code for general use