Move regex into the to_python method and compile.