How to create a script that simulates the blinking terminal cursor? I try to create a script that simulates the blinking of terminal cursor

layout.prop(text,'character')
if text.character
    layout.prop(text,'source_character')

def uptext(text):
if text.character &gt; 0:
blinking = [" ",text.source_character]
character2 = random.choice(blinking)
character3 = character2

text.body = character3


but the blinking is very fast, I would like to know how to improve and to correct
consider .... pseudo code ... 

    n = 1 // for slower use 2
    fps = 24 //frames per second .. change to suit you
    timeperiod = n * fps
    if (frame % timeperiod) &gt; (.5 * timeperiod):
       then show cursor 
       else do not show cursor
// frame is the current frame provided by Blender
// fps is the actual frames per second intended for final render


Please inspect and correct the pseudo code above