"""
Driver for the Stanford Research PRS10 Rubidium Clock
"""
import serial

class Clock:

    def __init__(self, COM=0):
        comport = '/dev/ttyUSB%d' %(COM)  # This is Linux specific like this
        # Settings from the manual
        self.__ser = serial.Serial(comport,
                                   baudrate=9600,
                                   bytesize=8,
                                   stopbits=2,
                                   parity=serial.PARITY_NONE,
                                   xonxoff=1,
                                   timeout=1,
                                   )

    def write(self, message):
        """ Write to the device """
        self.__ser.write("%s\r" %message) # Adding the line-feed that is the command delimiter

    def read(self):
        """ Read one line from the device """
        return self.__ser.readline()

    def ask(self, query):
        self.write(query)
        return self.read()

    def setupWithGPS(self):
        """ Reset settings suitable for 1PPS stabilization from GPS """
        clock.write("LM1") # Enable digital pre-filter for the incoming 1PPS signal from GPS
        clock.write("PT14") # Set longest PLL parameter for 1PPS input with bad short-term stability

if __name__ == "__main__":
    clock = Clock()
    print "Unit ID: %s" %(clock.ask("ID?"))

@@ -87,39 +87,298 @@
 ck:%0A
-%0A    def __init__(self, COM=0):
+    %22%22%22%0A    Rubidium clock that can be used with an 1 pulse-per-second (1PPS) signal to%0A    keep it accurate. Controlled through serial (RS-232) interface%0A    %22%22%22%0A    __ser = None # The private interface to the device%0A%0A    def __init__(self, COM=0):%0A        %22%22%22 Connecting to the device %22%22%22
 %0A   
@@ -1158,16 +1158,70 @@
 query):%0A
+        %22%22%22 Write a command and listen for answer %22%22%22%0A
         

add more comments and clean code