def DegreeDist(model, node_type='metabolites', bipartite=True):
    """ node_type = "metabolites" | "reactions" """
    rv = {}
    if 'met' in node_type:
        names = model.Metabolites()
    elif 'reac' in node_type:
        names = model.Reactions()
    for n in names:
        deg = model.Degree(n, bipartite=bipartite)
        if deg in rv.keys():
            rv[deg] = rv[deg] + 1
        else:
            rv[deg] = 1
    return rv
