<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def erase_text(self, locator, click=True, clear=False, backspace=0, params=None):
 """ Various ways to erase text from web element. :param locator: locator tuple or WebElement instance :param click: clicks the input field :param clear: clears the input field :param backspace: how many times to hit backspace :param params: (optional) locator params :return: None """

        element = locator
        if not isinstance(element, WebElement):
            element = self.get_visible_element(locator, params)

        if click:
            self.click(element)

        if clear:
            element.clear()

        if backspace:
            actions = ActionChains(self.driver)
            for _ in range(backspace):
                actions.send_keys(Keys.BACKSPACE)
            actions.perform()