def get_shape(bdg, iwu_bdg, a_ref):
    """
    Takes the IWU reference building and scales its shape such
     that it fits the given reference area

    :param bdg: Dictionary with the relevant parameters
    :param iwu_bdg: IWU-Reference building as dictionary
    :param a_ref: float
    :return: bdg
    """
    bdg['A_ref'] = a_ref
    ratio = a_ref / iwu_bdg['A_C_Ref']
    bdg['n_Storey'] = iwu_bdg['n_Storey']
    bdg['h_room'] = iwu_bdg['h_room']
    for di in ['North', 'East', 'South', 'West']:
        bdg['A_Window_' + di] = iwu_bdg['A_Window_' + di] * ratio ** 0.5
    bdg['A_Window_Horizontal'] = iwu_bdg['A_Window_Horizontal'
        ] * ratio / iwu_bdg['n_Storey']
    bdg['A_Window'] = sum(bdg['A_Window_' + di] for di in ['North', 'East',
        'South', 'West', 'Horizontal'])
    bdg['F_sh_vert'] = iwu_bdg['F_sh_vert']
    bdg['F_sh_hor'] = iwu_bdg['F_sh_hor']
    bdg['F_f'] = iwu_bdg['F_f']
    bdg['F_w'] = iwu_bdg['F_w']
    for wall in ['Wall_1', 'Wall_2', 'Wall_3']:
        bdg['A_' + wall] = iwu_bdg['A_' + wall] * ratio ** 0.5
    for roof in ['Roof_1', 'Roof_2']:
        bdg['A_' + roof] = iwu_bdg['A_' + roof] * (1 + (ratio - 1) /
            iwu_bdg['n_Storey'])
    for floor in ['Floor_1', 'Floor_2']:
        bdg['A_' + floor] = iwu_bdg['A_' + floor] * (1 + (ratio - 1) /
            iwu_bdg['n_Storey'])
    for door in ['Door_1']:
        bdg['A_' + door] = iwu_bdg['A_' + door] * ratio ** 0.5
    return bdg
