code: def _sorted_keys(self, keys):
          sorted_keys = []
          if ('epoch' in keys) and ('epoch' not in self.keys_ignored_):
              sorted_keys.append('epoch')
          for key in sorted(keys):
              if not (
                      (key in ('epoch', 'dur')) or
                      (key in self.keys_ignored_) or
                      key.endswith('_best') or
                      key.startswith('event_')
              ):
                  sorted_keys.append(key)
          for key in sorted(keys):
              if key.startswith('event_') and (key not in self.keys_ignored_):
                  sorted_keys.append(key)
          if ('dur' in keys) and ('dur' not in self.keys_ignored_):
              sorted_keys.append('dur')
          return sorted_keys