func (o Object) List() (List, error) {
	l := List{o}
	if C.whiskey_check_list(o.PyObject) == 0 {
		return l, errors.New("object is not a list")
	}
	return l, nil
}
List wraps the object in a List struct.
The underlying type must be a Python list or an error will be returned.
package py
import "C"
import (
	"fmt"
	"unsafe"
	"github.com/pkg/errors"
)
type Object struct {
	PyObject *C.PyObject
}
func NewModuleString(name, src string) (Object, error) {
	var o Object
	cs := C.CString(src)
	cfn := C.CString(fmt.Sprintf("<string src for %s>", name))
	co := C.Py_CompileStringFlags(cs, cfn, C.Py_file_input, nil)
	C.free(unsafe.Pointer(cs))
	C.free(unsafe.Pointer(cfn))
	if co == nil {
		return o, errors.Errorf("error compiling source for module %s: %s", name, GetError())
	}
	defer C.Py_DecRef(co)
	cn := C.CString(name)
	o.PyObject = C.PyImport_ExecCodeModule(cn, co)
	C.free(unsafe.Pointer(cn))
	if o.PyObject == nil {
		return o, errors.Errorf("error executing module %s: %s", name, GetError())
	}
	return o, nil
}
func ImportModule(moduleName string) (Object, error) {
	var o Object
	cs := C.CString(moduleName)
	o.PyObject = C.PyImport_ImportModule(cs)
	C.free(unsafe.Pointer(cs))
	if o.PyObject == nil {
		return o, errors.Errorf("error importing module %s: %s", moduleName, GetError())
	}
	return o, nil
}
func (o Object) Call(args ...Object) (Object, error) {
	var result Object
	var t Tuple
	if len(args) > 0 {
		var err error
		t, err = NewTupleObjects(args)
		if err != nil {
			return result, err
		}
		defer t.DecRef()
	}
	result.PyObject = C.PyObject_CallObject(o.PyObject, t.PyObject)
	if result.PyObject == nil {
		return result, errors.Errorf("error calling object: %s", GetError())
	}
	return result, nil
}
func (o Object) ConvertInto(ptr interface{}) error {
	switch t := ptr.(type) {
	case *List:
		pl, err := o.List()
		if err != nil {
			return err
		}
		pl.IncRef()
		*t = pl
	case *Object:
		o.IncRef()
		*t = o
	case *String:
		ps, err := o.String()
		if err != nil {
			return err
		}
		ps.IncRef()
		*t = ps
	case *int:
		n, err := o.GoInt()
		if err != nil {
			return err
		}
		*t = n
	case *string:
		s, err := o.GoString()
		if err != nil {
			return err
		}
		*t = s
	default:
		return errors.New("unsupported type for ptr")
	}
	return nil
}
func (o Object) DecRef() {
	if o.PyObject != nil {
		C.Py_DecRef(o.PyObject)
	}
}
func (o Object) IncRef() {
	if o.PyObject != nil {
		C.Py_IncRef(o.PyObject)
	}
}
func (o Object) GoInt() (int, error) {
	pn, err := o.Int()
	if err != nil {
		return 0, err
	}
	return pn.GoInt()
}
func (o Object) GoString() (string, error) {
	ps, err := o.String()
	if err != nil {
		return "", err
	}
	return ps.GoString()
}
func (o Object) Int() (Int, error) {
	n := Int{o}
	if C.whiskey_check_int(o.PyObject) == 0 {
		return n, errors.New("object is not an integer")
	}
	return n, nil
}