def ensure_unicode(value):
    """
    Decode UTF-8 values

    Args:
        value: value to be decoded

    Returns:
        decoded valued

    """
    if type(value) is not text_type:
        try:
            value = value.decode('utf-8')
        except UnicodeDecodeError:
            value = value.decode('gbk')
    return value

    Decode UTF-8 values

    Args:
        value: value to be decoded

    Returns:
        decoded valued

    
airtest/core/android/ime.py