code: def _send_command(self, cmd, expect=None):
          
          if not self.is_alive:
              raise NotPlayingError()
          logger.debug("Send command to mplayer: " + cmd)
          cmd = cmd + "\n"
          # In Py3k, TypeErrors will be raised because cmd is a string but stdin
          # expects bytes. In Python 2.x on the other hand, UnicodeEncodeErrors
          # will be raised if cmd is unicode. In both cases, encoding the string
          # will fix the problem.
          try:
              self.sub_proc.stdin.write(cmd)
          except (TypeError, UnicodeEncodeError):
              self.sub_proc.stdin.write(cmd.encode('utf-8', 'ignore'))
          time.sleep(0.1)     # wait for mplayer (better idea?)
          # Expect a response for 'get_property' only
          if not expect:
              return
          while True:
              try:
                  output = self.sub_proc.stdout.readline().rstrip()
                  output = output.decode('utf-8')
              except IOError:
                  return None
              # print output
              split_output = output.split('=')
              # print(split_output)
              if len(split_output) == 2 and split_output[0].strip() == expect:
                  # We found it
                  value = split_output[1]
                  return value.strip()
docs: Send a command to MPlayer.
  
          cmd: the command string
          expect: expect the output starts with a certain string
          The result, if any, is returned as a string.