code: def prepare_url(hostname, path, params=None):
          
          url = hostname + path
  
          if params:
              url = url + '?' + urlencode(params)
  
          if not url.startswith(('http:', 'https:')):
              url = "http://" + url
  
          return url.encode('utf-8')
docs: Prepare Elasticsearch request url.
          :param hostname: host name
          :param path: request path
          :param params: optional url params
          :return: