import copy


def _make_ml_graph(mm_g, corrections):
    """
    Create a ML/MM graph, using an MM graph, and corrections to that.

    Parameters
    ----------
    mm_g : nx.DiGraph()
        Graph object with MM results
    corrections : dict(int:(float,float))
        Stored per-ligand corrections in the format ligand_ID:(correction, uncertainty)

    Returns
    -------
    nx.DiGraph
        Graph object with relative MM free energies

    """
    ml_g = copy.deepcopy(mm_g)
    for node in ml_g.nodes(data=True):
        node[1]['calc_DG'] = node[1]['calc_DG'] + corrections[node[0]][0]
        node[1]['calc_dDG'] = (node[1]['calc_dDG']**2 + corrections[node[0]][1]**2)**0.5
    return ml_g