def _create_storage(storage_service, trajectory=None, **kwargs):
    """Creates a service from a constructor and checks which kwargs are not used"""
    kwargs_copy = kwargs.copy()
    kwargs_copy['trajectory'] = trajectory
    matching_kwargs = get_matching_kwargs(storage_service, kwargs_copy)
    storage_service = storage_service(**matching_kwargs)
    unused_kwargs = set(kwargs.keys()) - set(matching_kwargs.keys())
    return storage_service, unused_kwargs
Creates a service from a constructor and checks which kwargs are not used