docs: def get_endpoint(api_key, query, offset, type):
      """Return endpoint URL for the relevant search type.
  
      The base API endpoint only varies by type of search requested, of
      which there are two: 1) domain search and 2) email search. Each
      search type requires different parameters, though api_key is common
      between them.
  
      Note: if both a url and email address are provided the endpoint
      returned will default to the domain search as it is considered to
      be the primary function of the API and thus takes precedent.
  
      :param api_key: Secret client API key.
      :param query: URL or email address on which to search.
      :param offset: Specifies the number of emails to skip.
      :param type: Specifies email type (i.e. generic or personal).
  
      """
  
      query_type = get_query_type(query)
  
      if query_type not in ('domain', 'email'):
          raise ex.InvalidQueryStringException('Invalid query string')
  
      if query_type == 'domain':
          return DOMAIN_URL.format(query, api_key, offset, type)
      else:
          return EMAIL_URL.format(query, api_key)