def add_cohp_dict(self, cohp_dict, key_sort_func=None):
        """
        Adds a dictionary of COHPs with an optional sorting function
        for the keys.

        Args:
            cohp_dict: dict of the form {label: Cohp}

            key_sort_func: function used to sort the cohp_dict keys.
        """
        if key_sort_func:
            keys = sorted(cohp_dict.keys(), key=key_sort_func)
        else:
            keys = cohp_dict.keys()
        for label in keys:
            self.add_cohp(label, cohp_dict[label])
def add_cohp_dict ( self , cohp_dict , key_sort_func = None ) : if key_sort_func : keys = sorted ( cohp_dict . keys ( ) , key = key_sort_func ) else : keys = cohp_dict . keys ( ) for label in keys : self . add_cohp ( label , cohp_dict [ label ] )
Adds a dictionary of COHPs with an optional sorting function
        for the keys.

        Args:
            cohp_dict: dict of the form {label: Cohp}

            key_sort_func: function used to sort the cohp_dict keys.