def init_services(service_definitions, service_context, state_db,
                  client_authn_factory=None):
    """
    Initiates a set of services

    :param service_definitions: A dictionary cotaining service definitions
    :param service_context: A reference to the service context, this is the same
        for all service instances.
    :param state_db: A reference to the state database. Shared by all the
        services.
    :param client_authn_factory: A list of methods the services can use to
        authenticate the client to a service.
    :return: A dictionary, with service name as key and the service instance as
        value.
    """
    service = {}
    for service_name, service_configuration in service_definitions.items():
        try:
            kwargs = service_configuration['kwargs']
        except KeyError:
            kwargs = {}

        kwargs.update({'service_context': service_context,
                       'state_db': state_db,
                       'client_authn_factory': client_authn_factory})

        if isinstance(service_configuration['class'], str):
            _srv = util.importer(service_configuration['class'])(**kwargs)
        else:
            _srv = service_configuration['class'](**kwargs)

        try:
            service[_srv.service_name] = _srv
        except AttributeError:
            raise ValueError("Could not load '{}'".format(service_name))

    return service
Initiates a set of services

    :param service_definitions: A dictionary cotaining service definitions
    :param service_context: A reference to the service context, this is the same
        for all service instances.
    :param state_db: A reference to the state database. Shared by all the
        services.
    :param client_authn_factory: A list of methods the services can use to
        authenticate the client to a service.
    :return: A dictionary, with service name as key and the service instance as
        value.