def generateBuiltinUnicodeCode(to_name, expression, emit, context):
    encoding = expression.getEncoding()
    errors = expression.getErrors()

    if encoding is None and errors is None:
        generateCAPIObjectCode(
            to_name    = to_name,
            capi       = "PyObject_Unicode",
            arg_desc   = (
                (
                    "str_arg" if python_version < 300 \
                      else "unicode_arg",
                    expression.getValue()
                ),
            ),
            may_raise  = expression.mayRaiseException(BaseException),
            source_ref = expression.getCompatibleSourceReference(),
            emit       = emit,
            context    = context
        )
    else:
        generateCAPIObjectCode(
            to_name    = to_name,
            capi       = "TO_UNICODE3",
            arg_desc   = (
                ("unicode_arg", expression.getValue()),
                ("unicode_encoding", encoding),
                ("unicode_errors", errors),
            ),
            may_raise  = expression.mayRaiseException(BaseException),
            source_ref = expression.getCompatibleSourceReference(),
            none_null  = True,
            emit       = emit,
            context    = context,
        )
dataset/ETHPy150Open kayhayen/Nuitka/nuitka/codegen/StringCodes.py/generateBuiltinUnicodeCode/original