def compatibility_layer(spec):
    """Make specs compatible with older versions of Connexion."""
    if not isinstance(spec, dict):
        return spec
    for path_name, methods_available in spec.get('paths', {}).items():
        for method_name, method_def in methods_available.items():
            if method_name == 'parameters' or not isinstance(method_def, dict):
                continue
            response_definitions = {}
            for response_code, response_def in method_def.get('responses', {}
                ).items():
                response_definitions[str(response_code)] = response_def
            method_def['responses'] = response_definitions
    return spec
