def METHOD_NAME(self, s):
    '''Send data to the subprocess' stdin.
    Returns the number of bytes written.
    '''
    s = self._coerce_send_string(s)
    self._log(s, 'send')
    b = self._encoder.encode(s, final=False)
    if PY3:
        return self.proc.stdin.write(b)
    else:
        # On Python 2, .write() returns None, so we return the length of
        # bytes written ourselves. This assumes they all got written.
        self.proc.stdin.write(b)
        return len(b)