def building_class(BIM):
    """
    Short description

    Long description

    Parameters
    ----------
    BIM: dictionary
        Information about the building characteristics.

    Returns
    -------
    bldg_class: str
        One of the standard building class labels from HAZUS
    """

    if BIM['bldg_type'] == 3001:
        if ((BIM['occupancy_class'] == 'RES1') or
            ((BIM['roof_shape'] != 'flt') and (BIM['occupancy_class'] == ''))):
            # BuildingType = 3001
            # OccupancyClass = RES1
            # Wood Single-Family Homes (WSF1 or WSF2)
            # OR roof type = flat (HAZUS can only map flat to WSF1)
            # OR default (by '')
            if BIM['roof_shape'] == 'flt': # checking if there is a misclassication
                BIM['roof_shape'] = 'gab' # ensure the WSF has gab (by default, note gab is more vulneable than hip)
            return 'WSF'
        else:
            # BuildingType = 3001
            # OccupancyClass = RES3, RES5, RES6, or COM8
            # Wood Multi-Unit Hotel (WMUH1, WMUH2, or WMUH3)
            return 'WMUH'
    elif BIM['bldg_type'] == 3002:
        if ((BIM['design_level'] == 'E') and
            (BIM['occupancy_class'] in ['RES3A', 'RES3B', 'RES3C', 'RES3D',
                                            'RES3E', 'RES3F'])):
            # BuildingType = 3002
            # Steel Engineered Residential Building (SERBL, SERBM, SERBH)
            return 'SERB'
        elif ((BIM['design_level'] == 'E') and
              (BIM['occupancy_class'] in ['COM1', 'COM2', 'COM3', 'COM4', 'COM5',
                                          'COM6', 'COM7', 'COM8', 'COM9','COM10'])):
            # BuildingType = 3002
            # Steel Engineered Commercial Building (SECBL, SECBM, SECBH)
            return 'SECB'
        elif ((BIM['design_level'] == 'PE') and
              (BIM['occupancy_class'] not in ['RES3A', 'RES3B', 'RES3C', 'RES3D',
                                          'RES3E', 'RES3F'])):
            # BuildingType = 3002
            # Steel Pre-Engineered Metal Building (SPMBS, SPMBM, SPMBL)
            return 'SPMB'
        else:
            return 'SECB'
    elif BIM['bldg_type'] == 3003:
        if ((BIM['design_level'] == 'E') and
            (BIM['occupancy_class'] in ['RES3A', 'RES3B', 'RES3C', 'RES3D',
                                         'RES3E', 'RES3F', 'RES5', 'RES6'])):
            # BuildingType = 3003
            # Concrete Engineered Residential Building (CERBL, CERBM, CERBH)
            return 'CERB'
        elif ((BIM['design_level'] == 'E') and
              (BIM['occupancy_class'] in ['COM1', 'COM2', 'COM3', 'COM4', 'COM5',
                                          'COM6', 'COM7', 'COM8', 'COM9','COM10'])):
            # BuildingType = 3003
            # Concrete Engineered Commercial Building (CECBL, CECBM, CECBH)
            return 'CECB'
        else:
            return 'CECB'
    elif BIM['bldg_type'] == 3004:
        if BIM['occupancy_class'] == 'RES1':
            # BuildingType = 3004
            # OccupancyClass = RES1
            # Masonry Single-Family Homes (MSF1 or MSF2)
            return 'MSF'
        elif ((BIM['occupancy_class'] in ['RES3A', 'RES3B', 'RES3C', 'RES3D',
                                        'RES3E', 'RES3F']) and (BIM['design_level'] == 'E')):
            # BuildingType = 3004
            # Masonry Engineered Residential Building (MERBL, MERBM, MERBH)
            return 'MERB'
        elif ((BIM['occupancy_class'] in ['COM1', 'COM2', 'COM3', 'COM4',
                                        'COM5', 'COM6', 'COM7', 'COM8', 'COM9',
                                        'COM10']) and (BIM['design_level'] == 'E')):
            # BuildingType = 3004
            # Masonry Engineered Commercial Building (MECBL, MECBM, MECBH)
            return 'MECB'
        elif BIM['occupancy_class'] in ['IND1', 'IND2', 'IND3', 'IND4', 'IND5', 'IND6']:
            # BuildingType = 3004
            # Masonry Low-Rise Masonry Warehouse/Factory (MLRI)
            return 'MLRI'
        elif BIM['occupancy_class'] in ['RES3A', 'RES3B', 'RES3C', 'RES3D',
                                        'RES3E', 'RES3F', 'RES5', 'RES6', 'COM8']:
            # BuildingType = 3004
            # OccupancyClass = RES3X or COM8
            # Masonry Multi-Unit Hotel/Motel (MMUH1, MMUH2, or MMUH3)
            return 'MMUH'
        elif ((BIM['stories'] == 1) and
                (BIM['occupancy_class'] in ['COM1', 'COM2'])):
            # BuildingType = 3004
            # Low-Rise Masonry Strip Mall (MLRM1 or MLRM2)
            return 'MLRM'
        else:
            return 'MECB' # for others not covered by the above
        #elif ((BIM['occupancy_class'] in ['RES3A', 'RES3B', 'RES3C', 'RES3D',
        #                                'RES3E', 'RES3F', 'RES5', 'RES6',
        #                                'COM8']) and (BIM['design_level'] in ['NE', 'ME'])):
        #    # BuildingType = 3004
        #    # Masonry Multi-Unit Hotel/Motel Non-Engineered
        #    # (MMUH1NE, MMUH2NE, or MMUH3NE)
        #    return 'MMUHNE'
    elif BIM['bldg_type'] == 3005:
        return 'MH'

    else:
        return 'WMUH'
        # if nan building type is provided, return the dominant class