text: #include <Python.h>
  
  #include "timetravel.h"
  
  static PyObject *timetravel_getpowhash(PyObject *self, PyObject *args)
  {
      char *output;
      PyObject *value;
  #if PY_MAJOR_VERSION >= 3
      PyBytesObject *input;
  #else
      PyStringObject *input;
  #endif
      if (!PyArg_ParseTuple(args, "S", &input))
          return NULL;
      Py_INCREF(input);
      output = PyMem_Malloc(32);
  
  #if PY_MAJOR_VERSION >= 3
      timetravel_hash((char *)PyBytes_AsString((PyObject*) input), output, 256);
  #else
      timetravel_hash((char *)PyString_AsString((PyObject*) input), output, 256);
  #endif
      Py_DECREF(input);
  #if PY_MAJOR_VERSION >= 3
      value = Py_BuildValue("y#", output, 32);
  #else
      value = Py_BuildValue("s#", output, 32);
  #endif
      PyMem_Free(output);
      return value;
  }
  
  static PyMethodDef TimetravelMethods[] = {
      { "getPoWHash", timetravel_getpowhash, METH_VARARGS, "Returns the proof of work hash using timetravel hash" },
      { NULL, NULL, 0, NULL }
  };
  
  #if PY_MAJOR_VERSION >= 3
  static struct PyModuleDef TimetravelModule = {
      PyModuleDef_HEAD_INIT,
      "timetravel_hash",
      "...",
      -1,
      TimetravelMethods
  };
  
  PyMODINIT_FUNC PyInit_timetravel_hash(void) {
      return PyModule_Create(&TimetravelModule);
  }
  
  #else
  
  PyMODINIT_FUNC inittimetravel_hash(void) {
      (void) Py_InitModule("timetravel_hash", TimetravelMethods);
  }
  #endif
  