#infinite loop
while True:

    #acquire the keyboard hit if exists
    x = kbfunc() 

    #if we got a keyboard hit
    if x != False and x.decode() == 'r':
        #we got the key!
        #because x is a binary, we need to decode to string
        #use the decode() which is part of the binary object
        #by default, decodes via utf8
        #concatenation auto adds a space in between
        print ('dispensing')
        s.dispense(200)
        #break loop

    if x != False and x.decode() == 'f':
        #we got the key!
        #because x is a binary, we need to decode to string
        #use the decode() which is part of the binary object
        #by default, decodes via utf8
        #concatenation auto adds a space in between
        print ('retracting')
        s.retract(volume)
        #break loop
    if x != False and x.decode() == '1':
        #we got the key!
        #because x is a binary, we need to decode to string
        #use the decode() which is part of the binary object