<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def type(self, s, enter=False, clear=False):
 """Input some text, this method has been tested not very stable on some device. "Hi world" maybe spell into "H iworld" Args: - s: string (text to input), better to be unicode - enter(bool):
 input enter at last - next(bool):
 perform editor action Next - clear(bool):
 clear text before type - ui_select_kwargs(**):
 tap then type The android source code show that space need to change to %s insteresting thing is that if want to input %s, it is really unconvinent. android source code can be found here. https://android.googlesource.com/platform/frameworks/base/+/android-4.4.2_r1/cmds/input/src/com/android/commands/input/Input.java#159 app source see here: https://github.com/openatx/android-unicode """


        if clear:
            self.clear_text()

        self._uiauto.send_keys(s)

        if enter:
            self.keyevent('KEYCODE_ENTER')