How can I fix my Python function to convert strings to CamelCase