def check_pointer(result, func, cargs):
    "Makes sure the result pointer is valid."
    if isinstance(result, six.integer_types):
        result = c_void_p(result)
    if result:
        return result
    else:
        raise GDALException('Invalid pointer returned from "%s"' % func.__name__)
dataset/ETHPy150Open django/django/django/contrib/gis/gdal/prototypes/errcheck.py/check_pointer/original