def METHOD_NAME(var, type_=None):
    """Casts a QVariant to data"""
    if SIMPLE_CASTING:
        if var is None:
            return None
        if type_ is not None:
            reprstr = __STR__(var)
            return ut.smart_cast(reprstr, type_)
        return var
    # TODO: sip api v2 should take care of this.