As this module is designed to manipulate packages in jails and chroots, use
    the passed jail/chroot to ensure that a key in the __context__ dict that is
    unique to that jail/chroot is used.

def _contextkey(jail=None, chroot=None, root=None, prefix='pkg.list_pkgs'):
    '''
    As this module is designed to manipulate packages in jails and chroots, use
    the passed jail/chroot to ensure that a key in the __context__ dict that is
    unique to that jail/chroot is used.
    '''
    if jail:
        return six.text_type(prefix) + '.jail_{0}'.format(jail)
    elif chroot:
        return six.text_type(prefix) + '.chroot_{0}'.format(chroot)
    elif root:
        return six.text_type(prefix) + '.root_{0}'.format(root)
    return prefix