def _equivalent_for_plotgroup_update(p1,p2):
    """
    Helper function for save_plotgroup.

    Comparison operator for deciding whether make_plots(update==False) is
    safe for one plotgroup if the other has already been updated.

    Treats plotgroups as the same if the specified list of attributes
    (if present) match in both plotgroups.
    """

    attrs_to_check = ['pre_plot_hooks','keyname','sheet','x','y','projection','input_sheet','density','coords']

    for a in attrs_to_check:
        if hasattr(p1,a) or hasattr(p2,a):
            if not (hasattr(p1,a) and hasattr(p2,a) and getattr(p1,a)== getattr(p2,a)):
                return False

    return True