def pattern_to_mireval(ann):
<EOL>patterns = defaultdict(lambda: defaultdict(list))<EOL>for time, observation in zip(*ann.to_event_values()):<EOL><INDENT>pattern_id = observation['<STR_LIT>']<EOL>occurrence_id = observation['<STR_LIT>']<EOL>obs = (time, observation['<STR_LIT>'])<EOL>patterns[pattern_id][occurrence_id].append(obs)<EOL><DEDENT>return [list(_.values()) for _ in six.itervalues(patterns)]<EOL>
Convert a pattern_jku annotation object to mir_eval format.

    Parameters
    ----------
    ann : jams.Annotation
        Must have `namespace='pattern_jku'`

    Returns
    -------
    patterns : list of list of tuples
        - `patterns[x]` is a list containing all occurrences of pattern x

        - `patterns[x][y]` is a list containing all notes for
           occurrence y of pattern x

        - `patterns[x][y][z]` contains a time-note tuple
          `(time, midi note)`