code: def _BuildUrl(self, url, path_elements=None, extra_params=None):
          
          # Break url into constituent parts
          (scheme, netloc, path, params, query, fragment) = urlparse(url)
  
          # Add any additional path elements to the path
          if path_elements:
              # Filter out the path elements that have a value of None
              p = [i for i in path_elements if i]
              if not path.endswith('/'):
                  path += '/'
              path += '/'.join(p)
  
          # Add any additional query parameters to the query string
          if extra_params and len(extra_params) > 0:
              extra_query = self._EncodeParameters(extra_params)
              # Add it to the existing query
              if query:
                  query += '&' + extra_query
              else:
                  query = extra_query
  
          # Return the rebuilt URL
          return urlunparse((scheme, netloc, path, params, query, fragment))
docs: Taken from: https://github.com/bear/python-twitter/blob/master/twitter/api.py#L3814-L3836
          :param url:
          :param path_elements:
          :param extra_params:
          :return: