import re


def camel_case_to_snake_case(s):
    """Convert camel case names to snake case, for polyswarmd compatibility.

    :param s: String to convert
    :return: Converted string
    """
    s1 = re.sub(r'(.)([A-Z][a-z]+)', r'\1_\2', s)
    return re.sub(r'([a-z0-9])([A-Z])', r'\1_\2', s1).lower()