def calc_film_dimensions(aspect_ratio, camera, zoom):
    """
    Fit types:
    Horizontal = Horizontal size manually set.  Vertical size derived from aspect ratio.

    Vertical = Vertical size manually set.  Horizontal size derived from aspect ratio.

    Auto = sensor_width bpy property sets the horizontal size when the aspect ratio is over 1 and
    the vertical size when it is below 1.  Other dimension is derived from aspect ratio.

    Much thanks to the Radeon ProRender plugin for clarifying this behavior
    :param aspect_ratio:
    :param camera:
    :param zoom:
    :return:
    """

    horizontal_fit = camera.sensor_fit == 'HORIZONTAL' or \
                     (camera.sensor_fit == 'AUTO' and aspect_ratio > 1)

    if camera.sensor_fit == 'VERTICAL':
        film_height = camera.sensor_height / 1000 * zoom
        film_width = film_height * aspect_ratio
    elif horizontal_fit:
        film_width = camera.sensor_width / 1000 * zoom
        film_height = film_width / aspect_ratio
    else:
        film_height = camera.sensor_width / 1000 * zoom
        film_width = film_height * aspect_ratio

    return film_width, film_height