def _unicode_handler(obj):
    """
    Transforms an unicode string into a UTF-8 equivalent.

    :param obj: object to transform into it's UTF-8 equivalent
    :return: the UTF-8 equivalent of the string
    """
    try:
        result = obj.isoformat()
    except AttributeError:
        raise TypeError("Unserializable object {} of type {}".format(obj,
                                                                     type(obj)))

    return result
def _unicode_handler ( obj ) : try : result = obj . isoformat ( ) except AttributeError : raise TypeError ( "Unserializable object {} of type {}" . format ( obj , type ( obj ) ) ) return result
Transforms an unicode string into a UTF-8 equivalent.

    :param obj: object to transform into it's UTF-8 equivalent
    :return: the UTF-8 equivalent of the string