def shell_layout(G, nlist=None, dim=2, scale=1.0, center=None):
    """Position nodes in concentric circles.

    Parameters
    ----------
    G : NetworkX graph or list of nodes

    nlist : list of lists
       List of node lists for each shell.

    dim : int
       Dimension of layout, currently only dim=2 is supported

    scale : float (default 1)
        Scale factor for positions, i.e.radius of largest shell

    center : array-like (default origin)
       Coordinate around which to center the layout.

    Returns
    -------
    dict :
       A dictionary of positions keyed by node

    Examples
    --------
    >>> G = nx.path_graph(4)
    >>> shells = [[0], [1,2,3]]
    >>> pos = nx.shell_layout(G, shells)

    Notes
    -----
    This algorithm currently only works in two dimensions and does not
    try to minimize edge crossings.

    """
    import numpy as np
    if len(G) == 0:
        return {}
    if nlist is None:
        nlist = [list(G)]
    numb_shells = len(nlist)
    if len(nlist[0]) == 1:
        radius = 0.0
        numb_shells -= 1
    else:
        radius = 1.0
    gap = scale / numb_shells if numb_shells else scale
    radius *= gap
    npos = {}
    twopi = 2.0 * np.pi
    for nodes in nlist:
        theta = np.arange(0, twopi, twopi / len(nodes))
        pos = np.column_stack([np.cos(theta), np.sin(theta)]) * radius
        npos.update(zip(nodes, pos))
        radius += gap
    if center is not None:
        center = np.asarray(center)
        for n, p in npos.items():
            npos[n] = p + center
    return npos
