def cast_keep_none(obj, dest_type: type):
    """
    Cast ``obj`` to ``dest_type``.

    If ``obj`` is ``None``, returns ``None``.

    :param obj: object to be casted
    :param dest_type: target type to cast `obj`
    :return: casted `obj`
    """
    if obj is None:
        return None

    if issubclass(dest_type, bool):
        return dest_type(int(obj))

    return dest_type(obj)