human
Complete this python program:
def authenticate(username, password, service='login'):
assistant
#Here is the Python code you requested.

    """Returns True if the given username and password authenticate for the
    given service.  Returns False otherwise
    ``username``: the username to authenticate
    ``password``: the password in plain text
    ``service``: the PAM service to authenticate against.
    Defaults to \login\
    """
    @CONV_FUNC
    def my_conv(n_messages, messages, p_response, app_data):
        'Simple    conversation    function    that    responds    to    any\n                                prompt    where    the    echo    is    off    with    the    supplied    password'
        addr = CALLOC(n_messages, sizeof(PamResponse))
        p_response[0] = cast(addr, POINTER(PamResponse))
        for i in range(n_messages):
            if (messages[i].contents.msg_style == PAM_PROMPT_ECHO_OFF):
                pw_copy = STRDUP(str(password))
                p_response.contents[i].resp = cast(pw_copy, c_char_p)
                p_response.contents[i].resp_retcode = 0
        return 0
    handle = PamHandle()
    conv = PamConv(my_conv, 0)
    retval = PAM_START(service, username, pointer(conv), pointer(handle))
    if (retval != 0):
        return False
    retval = PAM_AUTHENTICATE(handle, 0)
    return (retval == 0)