def get_presentation_attributes(filename):
    """ Parses the given video-filename and determines the type of presentation (real or attack), the quality (laptop or mobile), 
        and in case of attack, the instrument used (video_hd, video_mobile, or print)
    Returns:
        presentation: a string either 'real' or 'attack'
        quality: a string either 'laptop' or 'mobile'
        instrument: a string, one of '', 'video_hd', 'video_mobile', 'print'. The value should be ''(empty str) IFF presentation is 'real'.
    """
    
    #input str 'filename' is assumed to have the structure like: './attack/attack_client006_android_SD_ipad_video_scene01.mp4'

    folder, filebase = filename.split('/',3)[-2:] #get last element of list returned by split().
    filebase = filebase.split('.')[0]
    nameparts = filebase.split('_')

    file_stem = folder+'/'+filebase

    presentation = nameparts[0]
    if presentation != 'attack' and presentation != 'real':
        assert False, 'Wrong presentation type.'
    
    cId = int((nameparts[1])[-3:])  #client-id extracted from filename.
    quality = nameparts[2]
    if quality != 'laptop' and quality != 'android':
        assert False, 'Wrong quality type.'
    if quality == 'android':
        quality = 'mobile'
    
    instrument = ''	#stored in nameparts[4] in case of attack.
    if presentation == 'attack':
        #'video_hd'==ipad, 'video_mobile'==iphone_video, 'print'==printed_photo
        if nameparts[4]=='ipad':
            instrument= 'video_hd'
        elif nameparts[4]=='iphone':
            instrument= 'video_mobile'
        elif nameparts[4]=='printed':
            instrument= 'print'
        else:
            assert False, 'We should never reach this point. Unknown attack-instrument!'

    return cId, file_stem, presentation, quality, instrument