'Find all snapVX sessions for a device (source and target).
:param array: the array serial number
:param device_id: the device id
:param tgt_only: Flag - return only sessions where device is target
:returns: list of snapshot dicts'

def find_snap_vx_sessions(self, array, device_id, tgt_only=False):

    (snap_dict_list, sessions) = ([], [])
    vol_details = self._get_private_volume(array, device_id)
    snap_vx_info = vol_details['timeFinderInfo']
    is_snap_src = snap_vx_info['snapVXSrc']
    is_snap_tgt = snap_vx_info['snapVXTgt']
    if snap_vx_info.get('snapVXSession'):
        sessions = snap_vx_info['snapVXSession']
    if (is_snap_src and (not tgt_only)):
        for session in sessions:
            if session.get('srcSnapshotGenInfo'):
                src_list = session['srcSnapshotGenInfo']
                for src in src_list:
                    snap_name = src['snapshotHeader']['snapshotName']
                    (target_list, target_dict) = ([], {})
                    if src.get('lnkSnapshotGenInfo'):
                        target_dict = src['lnkSnapshotGenInfo']
                    for tgt in target_dict:
                        target_list.append(tgt['targetDevice'])
                    link_info = {'target_vol_list': target_list, 'snap_name': snap_name, 'source_vol': device_id}
                    snap_dict_list.append(link_info)
    if is_snap_tgt:
        for session in sessions:
            if session.get('tgtSrcSnapshotGenInfo'):
                tgt = session['tgtSrcSnapshotGenInfo']
                snap_name = tgt['snapshotName']
                target_list = [tgt['targetDevice']]
                source_vol = tgt['sourceDevice']
                link_info = {'target_vol_list': target_list, 'snap_name': snap_name, 'source_vol': source_vol}
                snap_dict_list.append(link_info)
    return snap_dict_list
