<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _sorted_keys(self, keys):
 """Sort keys, dropping the ones that should be ignored. The keys that are in ``self.ignored_keys`` or that end on '_best' are dropped. Among the remaining keys: * 'epoch' is put first; * 'dur' is put last; * keys that start with 'event_' are put just before 'dur'; * all remaining keys are sorted alphabetically. """

        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