def read_until(ser, eol='\r'):
    """
    This func reads the serial device till a specified EOL is encountered OR if
    None is read, meaning timeout. The pyserial custom EOL is a PITA

    Args:
        ser: The opened serial object
        eol: Custom EOL character to stop reading

    Returns:
        reply (str): The reply the serial object returns

    """

    reply = ''
    resp = ser.read()
    while resp != '\r':
        reply = reply + resp
        resp = ser.read()
        if resp == '':
            # this captures timeouts
            break;

    return reply