code: def cmp_pkgrevno(package, revno, pkgcache=None):
      
      import apt_pkg
      if not pkgcache:
          from charmhelpers.fetch import apt_cache
          pkgcache = apt_cache()
      pkg = pkgcache[package]
      return apt_pkg.version_compare(pkg.current_ver.ver_str, revno)
docs: Compare supplied revno with the revno of the installed package.
  
      *  1 => Installed revno is greater than supplied arg
      *  0 => Installed revno is the same as supplied arg
      * -1 => Installed revno is less than supplied arg
  
      This function imports apt_cache function from charmhelpers.fetch if
      the pkgcache argument is None. Be sure to add charmhelpers.fetch if
      you call this function, or pass an apt_pkg.Cache() instance.