code: def play_file(self, wav_file, volume=100, play_type=PLAY_WAIT_FOR_COMPLETE):
          
          if not 0 < volume <= 100:
              raise ValueError('invalid volume (%s)' % volume)
  
          if not wav_file.endswith(".wav"):
              raise ValueError('invalid sound file (%s), only .wav files are supported' % wav_file)
  
          if not os.path.isfile(wav_file):
              raise ValueError("%s does not exist" % wav_file)
  
          self.set_volume(volume)
          self._validate_play_type(play_type)
  
          with open(os.devnull, 'w') as n:
  
              if play_type == Sound.PLAY_WAIT_FOR_COMPLETE:
                  pid = Popen(shlex.split('/usr/bin/aplay -q "%s"' % wav_file), stdout=n)
                  pid.wait()
  
              # Do not wait, run in the background
              elif play_type == Sound.PLAY_NO_WAIT_FOR_COMPLETE:
                  return Popen(shlex.split('/usr/bin/aplay -q "%s"' % wav_file), stdout=n)
  
              elif play_type == Sound.PLAY_LOOP:
                  while True:
                      pid = Popen(shlex.split('/usr/bin/aplay -q "%s"' % wav_file), stdout=n)
                      pid.wait()
docs: Play a sound file (wav format) at a given volume.
  
          :param string wav_file: The sound file path
          :param int volume: The play volume, in percent of maximum volume
  
          :param play_type: The behavior of ``play_file`` once playback has been initiated
          :type play_type: ``Sound.PLAY_WAIT_FOR_COMPLETE``, ``Sound.PLAY_NO_WAIT_FOR_COMPLETE`` or ``Sound.PLAY_LOOP``
  
          :returns: When ``Sound.PLAY_NO_WAIT_FOR_COMPLETE`` is specified, returns the spawn subprocess from ``subprocess.Popen``; ``None`` otherwise