<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _get(self, locator, expected_condition, params=None, timeout=None, error_msg="", driver=None, **kwargs):
 """ Get elements based on locator with optional parameters. Uses selenium.webdriver.support.expected_conditions to determine the state of the element(s). :param locator: element identifier :param expected_condition: expected condition of element (ie. visible, clickable, etc) :param params: (optional) locator parameters :param timeout: (optional) time to wait for element (default: self._explicit_wait) :param error_msg: (optional) customized error message :param driver: (optional) alternate Webdriver instance (example: parent-element) :param kwargs: optional arguments to expected conditions :return: WebElement instance, list of WebElements, or None """

        from selenium.webdriver.support.ui import WebDriverWait

        if not isinstance(locator, WebElement):
            error_msg += "\nLocator of type <{}> with selector <{}> with params <{params}>".format(
                *locator, params=params)
            locator = self.__class__.get_compliant_locator(*locator, params=params)

        _driver = driver or self.driver

        exp_cond = expected_condition(locator, **kwargs)
        if timeout == 0:
            try:
                return exp_cond(_driver)
            except NoSuchElementException:
                return None

        if timeout is None:
            timeout = self._explicit_wait

        error_msg += "\nExpected condition: {}" \
                     "\nTimeout: {}".format(expected_condition, timeout)

        return WebDriverWait(_driver, timeout).until(exp_cond, error_msg)