def _parse_authentication(url):
u = url<EOL>h = {}  <EOL>if url in _parse_authentication._memoize:<EOL><INDENT>u, h = _parse_authentication._memoize[url]<EOL><DEDENT>else:<EOL><INDENT>p = urlsplit(url, '<STR_LIT:http>')<EOL>if p.username and p.password:<EOL><INDENT>h['<STR_LIT>'] = b'<STR_LIT>' + base64.b64encode(p.username.encode() + b'<STR_LIT::>' + p.password.encode())<EOL>u = urlunsplit((p.scheme, p.netloc.split('<STR_LIT:@>', <NUM_LIT:1>)[<NUM_LIT:1>], p.path, p.query, p.fragment))<EOL><DEDENT>_parse_authentication._memoize[url] = (u, h)<EOL><DEDENT>return u, h<EOL>
Parse authentication data from the URL and put it in the `headers` dict. With caching behavior
    :param url: URL
    :type url: str
    :return: (URL without authentication info, headers dict)
    :rtype: str, dict