Converted Python connector to use Lwt