<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def hover(self, locator, params=None, use_js=False, alt_loc=None, alt_params=None):
 """ Context manager for hovering. Opens and closes the hover. Usage: with self.hover(locator, params):
 // do something with the hover :param locator: locator tuple or WebElement instance :param params: (optional) locator params :param use_js: use javascript to hover :param alt_loc: alternate locator tuple or WebElement instance for close hover :param alt_params: (optional) alternate locator params :return: None """

        # Open hover
        element = self.open_hover(locator, params, use_js)
        try:
            yield
        finally:
            # Close hover
            if alt_loc:
                element = alt_loc
                if not isinstance(element, WebElement):
                    element = self.get_visible_element(alt_loc, alt_params)
            self.close_hover(element, use_js)