code: def set_repeat(self, repeat_mode):
          
          # TODO: extract to convert module
          if int(repeat_mode) == const.REPEAT_STATE_OFF:
              state = 1
          elif int(repeat_mode) == const.REPEAT_STATE_ALL:
              state = 2
          elif int(repeat_mode) == const.REPEAT_STATE_TRACK:
              state = 3
          else:
              raise ValueError('Invalid repeat mode: ' + str(repeat_mode))
  
          return self.protocol.send(messages.repeat(state))
docs: Change repeat mode.