def get_hierarchical_net_pos(net):
    """ Get x,y positions for plotting hierarchical graph.

    For example:

    .. plot::
        :include-source:

        >>> import graphy
        >>> G = graphy.graphgen.gen_hierarchical_net(5, 2)
        >>> pos = graphy.graphgen.get_hierarchical_net_pos(G)
        >>> graphy.plotting.plot_graph(G, pos=pos)

    Parameters
    ----------
    net : networkx graph
        Graph whose nodes to layout

    Returns
    -------
    dict 
        Dictionary containing node:(x,y) entries

    """

    pos = {}

    for node in net.nodes():
        x, y = 0, 0
        xl = [0, -1, -1,  1,  1]
        yl = [0, -1,  1, -1,  1]
        for level_ndx, level in enumerate(map(int, node.title().split("."))):
            x += 0.5**level_ndx*(xl[level])
            y += 0.5**level_ndx*(yl[level])

        pos[node] = (x,y)

    return pos