def get_aspect(midata):
    """
    calculate aspect ratio from mediainfo data @midata
    returns: tuple (fraction_string, float, rounded)
    """
    smap = {1.78: "16:9", 1.5: "3:2", 1.33: "4:3", 1.25: "5:4"}
    # get aspect ratio reported in metadata
    iar = midata.get('display_aspect_ratio', midata.get('aspect', round(float(midata['width']) / float(midata['height']), 2)))
    if iar.count(':'):
        iar = float(iar.split(':')[0]) / float(iar.split(':')[1])
        dar = round(iar, 2)
    else:
        iar = float(iar)
        dar = round(iar, 2)
    return (smap.get(dar, str(dar)), iar, dar)