Python code for conversion of non deterministic FSM to deterministic FSM