def _parse_url(url):
  """Parse url, returning tuple of (username, password, address)

  :param url: HTTP endpoint (including protocol, port, and optional user /
    password).

  Supported url formats:

  + protocol://host:port
  + protocol://user@host:port
  + protocol://user:password@host:port
  + user@protocol://host:port (compatibility with older versions)
  + user:password@protocol://host:port (compatibility with older versions)

  """
  if not re.match(r'[a-zA-Z]+://', url) and not re.search(r'@[a-zA-Z]+://', url):
    # no scheme specified, default to http://
    url = 'http://' + url
  if re.search(r'@[a-zA-Z]+://', url):
    # compatibility mode: `user@protocol://host:port` or
    # `user:password@protocol://host:port`
    splitted = url.rstrip('/').split('@')
    if len(splitted) == 1:
      address = splitted[0]
      user = None
      password = None
    elif len(splitted) == 2:
      address = splitted[1]
      creds = splitted[0].split(':', 1)
      if len(creds) == 1:
        user = creds[0]
        password = None
      else:
        user, password = creds
    else:
      raise AzkabanError('Malformed url: %r' % (url, ))
    return user, password, address
  else:
    parsed = urlparse(url)
    return (parsed.username, parsed.password,
            (parsed.scheme, parsed.hostname, parsed.port) % '%s://%s:%s')
dataset/ETHPy150Open mtth/azkaban/azkaban/remote.py/_parse_url/swapped operands of `%`