def nest(flat_dict, separator='/'):
    """
    Converts a flat dictionary into a nested dictionary by splitting keys by a
    given separator.

    Args:
        flat_dict (dict): Flat dictionary.
        separator (str, optional): Field separator within given dictionary's
            keys. Default: '/'.

    Returns:
        dict: Nested dictionary.
    """
    output = {}
    for keys, val in flat_dict.items():
        split_keys = list(filter(lambda x: x != '', keys.split(separator)))
        cursor = output
        last = split_keys.pop()
        for key in split_keys:
            if key not in cursor:
                cursor[key] = {}
            if not isinstance(cursor[key], dict):
                msg = f"Duplicate key conflict. Key: '{key}'."
                raise KeyError(msg)
            cursor = cursor[key]
        cursor[last] = val
    return output
