code: def _auth(url, user, passwd, realm):
      '''
      returns a authentication handler.
      '''
  
      basic = _HTTPBasicAuthHandler()
      basic.add_password(realm=realm, uri=url, user=user, passwd=passwd)
      digest = _HTTPDigestAuthHandler()
      digest.add_password(realm=realm, uri=url, user=user, passwd=passwd)
      return _build_opener(basic, digestf _auth(url, user, passwd, realm):
      '''
      returns a authentication handler.
      '''
  
      basic = _HTTPBasicAuthHandler()
      basic.add_password(realm=realm, uri=url, user=user, passwd=passwd)
      digest = _HTTPDigestAuthHandler()
      digest.add_password(realm=realm, uri=url, user=user, passwd=passwd)
      return _build_opener(basic, digest)
docs: returns a authentication handler.