code: def build_locator(selector):
      
      if type(selector) is tuple:
          return selector
      if not isinstance(selector, six.string_types):
          raise InvalidSelectorException("Invalid locator values passed in")
  
      s = selector.strip()
      for test, by, index in selectors:
          if test(s):
              return by, s[index:]
      raise InvalidSelectorException("Invalid locator values passed in: {}".format(selector))
docs: - ID = "#valid_id"
      - CLASS_NAME = ".valid_class_name"
      - TAG_NAME = "valid_tag_name"
      - XPATH = start with "./" or "//" or "$x:"
      - LINK_TEXT = start with "$link_text:"
      - PARTIAL_LINK_TEXT = start with "$partial_link_text:"
      - NAME = "@valid_name_attribute_value"
  
      CSS_SELECTOR = all other that starts with *|.|#|[\w-]|\[|:
  
      :type selector: str|tuple
      :param selector:
      :rtype: tuple[selenium.webdriver.common.by.By, str]
      :return: