def cast_int_addr(n):
 if isinstance(n, (int, long)):
  return n
 try:
  import cffi
 except ImportError:
  pass
 else:
  ffi = cffi.FFI()
  if isinstance(n, ffi.CData):
   return int(ffi.cast('size_t', n))
 raise ValueError(('Cannot cast %r to int' % n))

def cast_int_addr ( n ) : if isinstance ( n , ( int , long ) ) : return n try : import cffi except ImportError : pass else : ffi = cffi . FFI ( ) if isinstance ( n , ffi . CData ) : return int ( ffi . cast ( 'size_t' , n ) ) raise ValueError ( ( 'Cannot cast %r to int' % n ) )
cast an address to a python int this could be a python integer or a cffi pointer .