<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def install_deb(pkgname, url):
 """Install package from custom deb hosted on S3. Return true if package was installed by this invocation."""

    status = run("dpkg-query -W -f='${{Status}}' {p}; true".format(p=pkgname))
    if ('installed' not in status) or ('not-installed' in status):
        deb = url.rpartition('/')[2]
        debtmp = '/tmp/{}'.format(deb)
        run("wget --no-check-certificate -qc -O '{}' '{}'".format(debtmp, url))
        sudo("dpkg -i '{0}' && rm -f '{0}'".format(debtmp))
        return True
    else:
        return False