def _get_safe_url(url):
 parts = urlsplit(url)
 if (parts.username is None):
  return url
 else:
  frags = list(parts)
  if parts.port:
   frags[1] = '{0}@{1}:{2}'.format(parts.username, parts.hostname, parts.port)
  else:
   frags[1] = '{0}@{1}'.format(parts.username, parts.hostname)
  return urlunsplit(frags)

def _get_safe_url ( url ) : parts = urlsplit ( url ) if ( parts . username is None ) : return url else : frags = list ( parts ) if parts . port : frags [ 1 ] = '{0}@{1}:{2}' . format ( parts . username , parts . hostname , parts . port ) else : frags [ 1 ] = '{0}@{1}' . format ( parts . username , parts . hostname ) return urlunsplit ( frags )
gets version of *url* with basic auth passwords obscured .