Ensuring that temporary Python module name only contains legal
characters.