Utility functions to convert strings to Python types