I think you can use NetMiko for this you would append "_serial" to your device type (this might not be supported for all device types, but it works on Cisco platforms and similar devices). Instead of providing a host/IP/port to ConnectHandler, use "serial_settings" = {"port": "/dev/ttyS01"}, replacing the port with your specific serial port. The "serial_settings" dictionary can also include values for baud rate, byte size, parity, and stop bits.
The other you can try is https://github.com/ktbyers/pynet/blob/master/serial/cisco_serial.py - never used this YMMV.
Hope this helps.
Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io