def get_subgraph_pos(G, pos):
    """ Returns the filtered positions for subgraph G. If subgraph = original graph then pos will be returned.

    Parameters 
    ----------

    G : nx.Graph
        A graph object.
    Pos : dict
        A dictionary with nodes as keys and positions as values.

    Example 
    -------

    >>> pos  = nx.spring_layout(G)
    >>> subgraph_nodes = ['1','2','3']
    >>> subgraph = G.subgraph(subgraph_nodes)
    >>> subgraph_positions = get_subgraph_pos(subgraph,pos)

    Returns
    -------
    dict 
        Assuming positions were generated earlier for a larger graph with some layout algorithm
        this functions returns the filtered positions by the subgraph. 

    """
    return {k: v for k, v in pos.items() if k in G.nodes()}