def _flatten_dotted(input_dict, prefix=''):
    """Convert nested dict into flat dict with dotted key notation.

    Given a nested dict, e.g.
        >>> input_dict = {'spam': {'eggs': 23}, 'answer': 42}

    create a flat dict with dotted keys for the nested items
        >>> output_dict = _flatten_dotted(input_dict)
        >>> output_dict == {'spam.eggs': 23, 'answer': 42}
        True

    Args:
        dict: Nested dict
        string: Key prefix, used for recursion. Should be left at the default
            for normal use.

    Returns:
        dict: Flattened dict with dotted notation.
    """
    output_dict = {}
    for key, value in input_dict.items():
        if prefix:
            dotted = prefix + '.' + key
        else:
            dotted = key
        if isinstance(value, dict):
            output_dict.update(_flatten_dotted(value, dotted))
        else:
            output_dict[dotted] = value
    return output_dict