def com(points, masses=None):
    """Calculate center of mass for given points.
    If masses is not set, assume equal masses."""
    if masses is None:
        return np.average(points, axis=0)
    else:
        return np.average(points, axis=0, weights=masses)
def com ( points , masses = None ) : if masses is None : return np . average ( points , axis = 0 ) else : return np . average ( points , axis = 0 , weights = masses )
Calculate center of mass for given points.
    If masses is not set, assume equal masses.