Reference: https://tools.ietf.org/html/rfc6243#section-4.3

def _get_valid_with_defaults_modes(capabilities):
    """Reference: https://tools.ietf.org/html/rfc6243#section-4.3"""
    capability = capabilities[":with-defaults"]

    try:
        valid_modes = [capability.parameters["basic-mode"]]
    except KeyError:
        raise WithDefaultsError(
            "Invalid 'with-defaults' capability URI advertised by the server; "
            "missing 'basic-mode' parameter"
        )

    try:
        also_supported = capability.parameters["also-supported"]
    except KeyError:
        return valid_modes

    valid_modes.extend(also_supported.split(","))

    return valid_modes