code: def get_driver(self, desired_capabilities=None):
          override_caps = desired_capabilities or {}
          desired_capabilities = \
              self.config.make_selenium_desired_capabilities()
          desired_capabilities.update(override_caps)
          browser_string = self.config.browser
          chromedriver_version = None
          if self.remote:
              driver = self.remote_service.build_driver(desired_capabilities)
              if browser_string == "CHROME" and \
                 self.remote_service.name == "saucelabs":
                  chromedriver_version = \
                      desired_capabilities.get("chromedriver-version", None)
                  if chromedriver_version is None:
                      raise ValueError(
                          "when using Chrome, you must set a "
                          "``chromedriver-version`` capability so that Selenic "
                          "can detect which version of Chromedriver will "
                          "be used.")
          else:
              if browser_string == "CHROME":
                  chromedriver_path = self.local_conf["CHROMEDRIVER_PATH"]
                  driver = webdriver.Chrome(
                      chromedriver_path,
                      chrome_options=self.local_conf.get("CHROME_OPTIONS"),
                      desired_capabilities=desired_capabilities,
                      service_log_path=self.local_conf["SERVICE_LOG_PATH"],
                      service_args=self.local_conf.get("SERVICE_ARGS"))
                  version_line = subprocess.check_output(
                      [chromedriver_path, "--version"])
                  version_str = re.match(ur"^ChromeDriver (\d+\.\d+)",
                                         version_line).group(1)
                  chromedriver_version = StrictVersion(version_str)
              elif browser_string == "FIREFOX":
                  profile = self.local_conf.get("FIREFOX_PROFILE") or \
                      FirefoxProfile()
                  binary = self.local_conf.get("FIREFOX_BINARY") or \
                      FirefoxBinary()
                  driver = webdriver.Firefox(profile, binary,
                                             capabilities=desired_capabilities)
              elif browser_string == "INTERNETEXPLORER":
                  driver = webdriver.Ie()
              elif browser_string == "OPERA":
                  driver = webdriver.Opera()
              else:
                  raise ValueError("can't start a local " + browser_string)
              driver_caps = NormalizedCapabilities(driver.desired_capabilities)
              browser_version = \
                  re.sub(r"\..*$", "", driver_caps["browserVersion"])
              if driver_caps["platformName"].upper() != self.config.platform:
                  raise ValueError("the platform you want is not the one "
                                   "you are running selenic on")
              if browser_version != self.config.version:
                  raise ValueError("the version installed is not the one "
                                   "you wanted")
          if (self.remote_service and
              self.remote_service.name == "browserstack") or \
             (chromedriver_version is not None and
                  chromedriver_version > StrictVersion("2.13")):
              chromedriver_element_center_patch()
              setattr(driver, CHROMEDRIVER_ELEMENT_CENTER_PATCH_FLAG, True)
          driver = self.patch(driver)
          return driver