def parse_hierarchical_kwargs(kwargs):
    """Parses a dict of kwargs by splitting the keys based on separator into
    subdictionaries

    Parameters
    ----------
    kwargs : dict
        the kwargs to parse

    Returns
    -------
    hierarchical_kwargs : dict

    Example
    -------
    > parse_hierarchical_kwargs({'a.b.c': 2, 'a.d': 5, 'e': 10})
    {'a': {'b': {'c': 2}, 'd': 5}, 'e': 10}


    """

    new_kwargs = {}

    for key, value in kwargs.items():
        k_split = key.split(".")
        root_k = k_split[0]
        child_k = ".".join(k_split[1:])

        if child_k:
            if root_k not in new_kwargs:
                new_kwargs[root_k] = {}

            new_kwargs[root_k][child_k] = value
        else:
            new_kwargs[key] = value

    for key in new_kwargs:
        if isinstance(new_kwargs[key], dict):
            new_kwargs[key] = parse_hierarchical_kwargs(new_kwargs[key])

    return new_kwargs