def METHOD_NAME(exp_name, sensor_name, scanning_type, pklg_file_name):
    print("Opening %s" % pklg_file_name)
    with open(pklg_file_name, "rb") as f:
        while True:
            try:
                (length, time_sec, time_usec, packet_type) = struct.unpack('>IIIB',f.read(13))
            except:
                break
            packet = bytearray(f.read(length - 9))
            reset_timestamp(packet_type, packet, time_sec)
            read_scan(packet_type, packet, time_sec)
    f.close();
    prefix = '../data/processed/'
    for k in devices.keys():
        data_file_name = ''
        if k == '5c:f3:70:60:7b:87:': #BCM
            data_file_name = prefix + exp_name+'_'+scanning_type +'_mac.data'
        if k == '00:1a:7d:00:86:7c:': #neo
            data_file_name = prefix + exp_name+'_'+scanning_type +'_'+sensor_name+'.data'
        if k == '00:07:80:67:45:bc:': #xg 1
            data_file_name = prefix + exp_name+'_'+scanning_type +'_'+sensor_name+'1.data'
        if k == '00:07:80:67:46:00:': #xg 2
            data_file_name = prefix + exp_name+'_'+scanning_type +'_'+sensor_name+'2.data'
        if not data_file_name:
            continue
        pickle.dump(devices[k], open(data_file_name, 'wb'))
        mes_index = 0
        # take the last measurement
        for i in range(len(devices[k])-1):
            if devices[k][i] > devices[k][i+1]:
                mes_index = i+1
        pickle.dump(devices[k][mes_index:len(devices[k])], open(data_file_name, 'wb'))