copying c2s.py here