def build_tree(list_of_strings):
    """Function takes a list of strings, ie:

    user.address.city
    user.address.postcode
    user.name.first
    user.name.last
    user.age

    And builds a tree of nested dictionaries.
    """
    tree = {}
    node = tree
    for key in list_of_strings:
        if '.' in key:
            bits = key.split('.')
            for bit in bits[:-1]:
                if bit not in list(node.keys()) or node[bit] is None:
                    node[bit] = {}
                node = node[bit]
            node[bits[-1]] = None
        else:
            node[key] = None
        node = tree
    return tree
