copy my old version of cosm.py here