code: def pitch_class_to_semitone(pitch_class):
      r'''Convert a pitch class to semitone.
  
      Parameters
      ----------
      pitch_class : str
          Spelling of a given pitch class, e.g. 'C#', 'Gbb'
  
      Returns
      -------
      semitone : int
          Semitone value of the pitch class.
  
      '''
      semitone = 0
      for idx, char in enumerate(pitch_class):
          if char == '#' and idx > 0:
              semitone += 1
          elif char == 'b' and idx > 0:
              semitone -= 1
          elif idx == 0:
              semitone = PITCH_CLASSES.get(char)
          else:
              raise InvalidChordException(
                  "Pitch class improperly formed: %s" % pitch_class)
      return semitone % 1f pitch_class_to_semitone(pitch_class):
      r'''Convert a pitch class to semitone.
  
      Parameters
      ----------
      pitch_class : str
          Spelling of a given pitch class, e.g. 'C#', 'Gbb'
  
      Returns
      -------
      semitone : int
          Semitone value of the pitch class.
  
      '''
      semitone = 0
      for idx, char in enumerate(pitch_class):
          if char == '#' and idx > 0:
              semitone += 1
          elif char == 'b' and idx > 0:
              semitone -= 1
          elif idx == 0:
              semitone = PITCH_CLASSES.get(char)
          else:
              raise InvalidChordException(
                  "Pitch class improperly formed: %s" % pitch_class)
      return semitone % 12
docs: r'''Convert a pitch class to semitone.
  
      Parameters
      ----------
      pitch_class : str
          Spelling of a given pitch class, e.g. 'C#', 'Gbb'
  
      Returns
      -------
      semitone : int
          Semitone value of the pitch class.