code: def from_cstr_to_pystr(data, length):
      
      if PY3:
          res = []
          for i in range(length.value):
              try:
                  res.append(str(data[i].decode('ascii')))
              except UnicodeDecodeError:
                  res.append(str(data[i].decode('utf-8')))
      else:
          res = []
          for i in range(length.value):
              try:
                  res.append(str(data[i].decode('ascii')))
              except UnicodeDecodeError:
                  # pylint: disable=undefined-variable
                  res.append(unicode(data[i].decode('utf-8')))
      return res
docs: Revert C pointer to Python str
  
      Parameters
      ----------
      data : ctypes pointer
          pointer to data
      length : ctypes pointer
          pointer to length of data