code: def map_sequences(sequence_str, mapping_name):
      """Map the NoteSequence for drums."""
      mapping = HIT_MAPS[mapping_name]
      drums_sequence = music_pb2.NoteSequence.FromString(sequence_str)
      simple_mapping = {}
      for pitch_class in mapping:
          for pitch in pitch_class:
              simple_mapping[pitch] = pitch_class[0]
  
      for note in drums_sequence.notes:
          if note.pitch not in simple_mapping:
              tf.logging.warn(
                  "Could not find mapping for pitch %d", note.pitch
              )
          else:
              note.pitch = simple_mapping[note.pitch]
      return drums_sequence.SerializeToString()
  
imports: from magenta.models.onsets_frames_transcription import constants
  from note_seq.protobuf import music_pb2
  import tensorflow.compat.v1
label_desc: Use image node_id 2 for calling a global function with example usage: map_sequences(sequence_str, mapping_name) and returns: drums_sequence