Python implementation of halogen