def query_merge(query: dict, **kwargs: dict) -> dict:
    """
    Merge a dictionary and key word arguments into a single dictionary.

    Used to merge a MongoDB query and key word arguments into a single query.

    :param query: The dictionary to merge.
    :param kwargs: The key word arguments to merge.
    :return: A dictionary merging query and kwargs.
    """
    if query is None:
        return kwargs
    else:
        return {**query, **kwargs}