def encode_safe(istr, encoding='utf8'):
    try:
        return istr.encode(encoding)
    except __HOLE__:
        # this will fail if istr is already encoded
        pass
    return istr
dataset/ETHPy150Open Demonware/jose/jose.py/encode_safe