def to_type_code(db_val: Union[float, int]) -> int:
        """Values read from DB may arrive as float, and empty values come as nan"""
        if isinstance(db_val, float):
            if math.isnan(db_val):
                return VehicleType.OTHER_AND_UNKNOWN.value
            else:
                return int(db_val)
        elif isinstance(db_val, int):
            return db_val
        else:
            logging.error(
                f"VehicleType.fo_type_code: unknown value: {db_val}({type(db_val)})"
                ". returning OTHER_AND_UNKNOWN"
            )
            return VehicleType.OTHER_AND_UNKNOWN.value