code: def _to_string(x):
      """Convert to a unicode string.
  
      If x is a byte string, assume it is utf-8 and decode to a Python unicode
      string. You must call this on text strings you get back from libvips.
  
      """
      if x == ffi.NULL:
          x = "NULL"
      else:
          x = ffi.string(x)
          if isinstance(x, byte_type):
              x = x.decode("utf-8")
  
      return x
  
file_path: pyvips/pyvips/error.py
imports: import sys
  import logging
  from pyvips import ffi, vips_lib, glib_lib
label_desc: Use image node_id 2 for calling a global function with example usage: _to_string(x) and returns: x