Returns pre/post snapshots made by a given Salt jid

    Looks for 'salt_jid' entries into snapshots userdata which are created
    when 'snapper.run' is executed.

def _get_jid_snapshots(jid, config='root'):
    '''
    Returns pre/post snapshots made by a given Salt jid

    Looks for 'salt_jid' entries into snapshots userdata which are created
    when 'snapper.run' is executed.
    '''
    jid_snapshots = [x for x in list_snapshots(config) if x['userdata'].get("salt_jid") == jid]
    pre_snapshot = [x for x in jid_snapshots if x['type'] == "pre"]
    post_snapshot = [x for x in jid_snapshots if x['type'] == "post"]

    if not pre_snapshot or not post_snapshot:
        raise CommandExecutionError("Jid '{0}' snapshots not found".format(jid))

    return (
        pre_snapshot[0]['id'],
        post_snapshot[0]['id']
    )