<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def camel_to_snake(camel):
 """Convert camelCase to snake_case."""

    ret = []
    last_lower = False
    for char in camel:
        current_upper = char.upper() == char
        if current_upper and last_lower:
            ret.append("_")
            ret.append(char.lower())
        else:
            ret.append(char.lower())
        last_lower = not current_upper
    return "".join(ret)