def METHOD_NAME(*, db_session, plugin_instance_in: PluginInstanceCreate) -> PluginInstance:
    """Creates a new plugin instance."""
    project = project_service.get_by_name_or_raise(
        db_session=db_session, project_in=plugin_instance_in.project
    )
    plugin = get(db_session=db_session, plugin_id=plugin_instance_in.plugin.id)
    plugin_instance = PluginInstance(
        **plugin_instance_in.dict(exclude={"project", "plugin", "configuration"}),
        project=project,
        plugin=plugin,
    )
    plugin_instance.configuration = plugin_instance_in.configuration
    db_session.add(plugin_instance)
    db_session.commit()
    return plugin_instance