code: def encode(chord_label, reduce_extended_chords=False,
             strict_bass_intervals=False):
      
  
      if chord_label == NO_CHORD:
          return NO_CHORD_ENCODED
      if chord_label == X_CHORD:
          return X_CHORD_ENCODED
      chord_root, quality, scale_degrees, bass = split(
          chord_label, reduce_extended_chords=reduce_extended_chords)
  
      root_number = pitch_class_to_semitone(chord_root)
      bass_number = scale_degree_to_semitone(bass) % 12
  
      semitone_bitmap = quality_to_bitmap(quality)
      semitone_bitmap[0] = 1
  
      for scale_degree in scale_degrees:
          semitone_bitmap += scale_degree_to_bitmap(scale_degree,
                                                    reduce_extended_chords)
  
      semitone_bitmap = (semitone_bitmap > 0).astype(np.int)
      if not semitone_bitmap[bass_number] and strict_bass_intervals:
          raise InvalidChordException(
              "Given bass scale degree is absent from this chord: "
              "%s" % chord_label, chord_label)
      else:
          semitone_bitmap[bass_number] = 1
      return root_number, semitone_bitmap, bass_number
docs: Translate a chord label to numerical representations for evaluation.
  
      Parameters
      ----------
      chord_label : str
          Chord label to encode.
      reduce_extended_chords : bool
          Whether to map the upper voicings of extended chords (9's, 11's, 13's)
          to semitone extensions.
          (Default value = False)
      strict_bass_intervals : bool
          Whether to require that the bass scale degree is present in the chord.
          (Default value = False)
  
      Returns
      -------
      root_number : int
          Absolute semitone of the chord's root.
      semitone_bitmap : np.ndarray, dtype=int
          12-dim vector of relative semitones in the chord spelling.
      bass_number : int
          Relative semitone of the chord's bass note, e.g. 0=root, 7=fifth, etc.