Interact with serial devices using pexpect.
Just use pip :)
pip install pexpect-serialspawn
import serial
from pexpect_serialspawn import SerialSpawn
# Initialize your serial device
ser = serial.Serial('COM1', 115200)
# Spawn a pexpect object
ss = SerialSpawn(ser, encoding='utf-8')
# Use as any other pexpect spawns...
ss.sendline('Hello')
ss.expect('World')