code: def url_path_replace(url, old, new, count=None):
      
      args = []
      scheme, netloc, path, query, fragment = urlparse.urlsplit(url)
      if count is not None:
          args.append(count)
      return urlparse.urlunsplit((
          scheme, netloc, path.replace(old, new, *args), query, fragment))
docs: Return a copy of url with replaced path.
  
      Return a copy of url with all occurrences of old replaced by new in the url
      path.  If the optional argument count is given, only the first count
      occurrences are replaced.