def _validate_endpoint(endpoint, check_native_endpoint=None):
    """
    Check a WAMP connecting endpoint configuration.
    """
    if check_native_endpoint:
        check_native_endpoint(endpoint)
    elif not isinstance(endpoint, dict):
        raise ValueError("'endpoint' must be a dict")
    if isinstance(endpoint, dict):
        if 'type' not in endpoint:
            raise ValueError("'type' required in endpoint configuration")
        if endpoint['type'] not in ['tcp', 'unix']:
            raise ValueError('invalid type "{}" in endpoint'.format(
                endpoint['type']))
        for k in endpoint.keys():
            if k not in ['type', 'host', 'port', 'path', 'tls']:
                raise ValueError("Invalid key '{}' in endpoint configuration"
                    .format(k))
        if endpoint['type'] == 'tcp':
            for k in ['host', 'port']:
                if k not in endpoint:
                    raise ValueError("'{}' required in 'tcp' endpoint config"
                        .format(k))
            for k in ['path']:
                if k in endpoint:
                    raise ValueError("'{}' not valid in 'tcp' endpoint config"
                        .format(k))
        elif endpoint['type'] == 'unix':
            for k in ['path']:
                if k not in endpoint:
                    raise ValueError("'{}' required for 'unix' endpoint config"
                        .format(k))
            for k in ['host', 'port', 'tls']:
                if k in endpoint:
                    raise ValueError("'{}' not valid in 'unix' endpoint config"
                        .format(k))
        else:
            assert False, 'should not arrive here'
