<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def getCert(username, password, certHost=_SERVER, certfile=None, certQuery=_PROXY):
 """Access the cadc certificate server."""


    if certfile is None:
        certfile = tempfile.NamedTemporaryFile()

    # Add the username and password.
    # If we knew the realm, we could use it instead of ``None``.
    password_mgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
    top_level_url = "http://" + certHost
    logging.debug(top_level_url)
    password_mgr.add_password(None, top_level_url, username, password)
    handler = urllib2.HTTPBasicAuthHandler(password_mgr)
    logging.debug(str(handler))
    # create "opener" (OpenerDirector instance)
    opener = urllib2.build_opener(handler)

    # Install the opener.   
    urllib2.install_opener(opener)

    # buuld the url that with 'GET' a certificat using user_id/password info
    url = "http://" + certHost + certQuery
    logging.debug(url)

    r = None
    try:
        r = opener.open(url)
    except urllib2.HTTPError as e:
        logging.debug(url)
        logging.debug(str(e))
        return False

    logging.debug(str(r))

    if r is not None:
        while True:
            buf = r.read()
            logging.debug(buf)
            if not buf:
                break
            certfile.write(buf)
        r.close()

    return certfile