def class_name_to_function_name(name):
    """Convert a python class name in CamelCase to a lower case function_name with underscores."""
    function_name = ""
    for char_idx, char in enumerate(name):
        if char == char.upper() and char_idx > 0 and name[char_idx - 1] == name[char_idx - 1].lower():
            function_name += "_"
        function_name += char.lower()
    return function_name