Add function to determines ports
Fix ctypes import