def find_labels(self,key,find_in_name=True,find_in_units=False):
        if type(key) is str:
            found_keys = []
            if key.startswith('~'):
                for label_no,label in enumerate(self.labels):
                    if find_in_name and key[1:] in label.name:
                        found_keys.append(label_no)
                    if find_in_units and key[1:] in label.units:
                        found_keys.append(label_no)
            else:
                for label_no,label in enumerate(self.labels):
                    if find_in_name and key == label.name:
                        return [label_no]
                    if find_in_units and key == label.units:
                        return [label_no]
            return found_keys
        if hasattr(key, '__call__'):
            found_keys = []
            for label_no,label in enumerate(self.labels):
                    if key(label):
                        found_keys.append(label_no)
            return found_keys
        if type(key) is int:
            return [key] if key < self.matrix.shape[1] else []
        return [key]