def check_pointer(result, func, cargs):
 if isinstance(result, (int, long)):
  result = c_void_p(result)
 if bool(result):
  return result
 else:
  raise OGRException(('Invalid pointer returned from "%s"' % func.__name__))

def check_pointer ( result , func , cargs ) : if isinstance ( result , ( int , long ) ) : result = c_void_p ( result ) if bool ( result ) : return result else : raise OGRException ( ( 'Invalid pointer returned from "%s"' % func . __name__ ) )
makes sure the result pointer is valid .