def METHOD_NAME(obj):
    if isinstance(obj, str) and sys.version_info < (3,):
        obj = unicode(obj, encoding='ascii', errors='strict')
    elif sys.version_info >= (3,) and isinstance(obj, bytes):
        obj = str(obj, encoding='ascii', errors='strict')
    return obj