def get_snap_revs(snaps):
    'Get a dict of snap revisions for a given list of snaps.'
    channel = hookenv.config('channel')
    rev_info = {}
    for s in sorted(snaps):
        try:
            info = check_output(['snap', 'info', s]).decode('utf8', errors='ignore')
        except CalledProcessError:
            info = ''
        snap_rev = None
        yaml_data = safe_load(info)
        if (yaml_data and ('channels' in yaml_data)):
            try:
                d = yaml_data['channels'][channel].split()
                snap_rev = d[2].strip('()')
            except (KeyError, IndexError):
                hookenv.log('Could not determine revision for snap: {}'.format(s), level=hookenv.WARNING)
        rev_info[s] = snap_rev
    return rev_info
Get a dict of snap revisions for a given list of snaps.
def get_snap_revs(snaps):
    
    channel = hookenv.config('channel')
    rev_info = {}
    for s in sorted(snaps):
        try:
            info = check_output(['snap', 'info', s]).decode('utf8', errors='ignore')
        except CalledProcessError:
            info = 
        snap_rev = None
        yaml_data = safe_load(info)
        if (yaml_data and ('channels' in yaml_data)):
            try:
                d = yaml_data['channels'][channel].split()
                snap_rev = d[2].strip('()')
            except (KeyError, IndexError):
                hookenv.log('Could not determine revision for snap: {}'.format(s), level=hookenv.WARNING)
        rev_info[s] = snap_rev
    return rev_info