def package_installed(module, name, category):
    cmd = [module.get_bin_path('pkginfo', True)]
    cmd.append('-q')
    if category:
        cmd.append('-c')
    cmd.append(name)
    rc, out, err = module.run_command(' '.join(cmd))
    if rc == 0:
        return True
    else:
        return False