convert CIT_magic for use one either command line or as imported module