docs: def to_enum(gtype, value):
          """Turn a string into an enum value ready to be passed into libvips.
  
          """
  
          if isinstance(value, basestring if _is_PY2 else str):
              enum_value = vips_lib.vips_enum_from_nick(b'pyvips', gtype,
                                                        _to_bytes(value))
              if enum_value < 0:
                  raise Error('no value {0} in gtype {1} ({2})'.
                              format(value, type_name(gtype), gtype))
          else:
              enum_value = value
  
          return enum_value