import turtle as tt
import inspect

stack = [] 
def peano(iterations=1):
    global stack

    
    ivan = tt.Turtle(shape = , visible = True)


    
    screen = tt.Screen()
    screen.title()
    screen.bgcolor()
    screen.delay(0) 
    screen.setup(width=0.95, height=0.9)

    
    walk = 1

    def screenlength(k):
        
        
        if k != 0:
            length = screenlength(k-1)
            return 2*length + 1
        else: return 0

    kkkj = screenlength(iterations)
    screen.setworldcoordinates(-1, -1, kkkj + 1, kkkj + 1)
    ivan.color(, )


    
    def step1(k):
        global stack
        stack.append(len(inspect.stack()))
        if k != 0:
            ivan.left(90)
            step2(k - 1)
            ivan.forward(walk)
            ivan.right(90)
            step1(k - 1)
            ivan.forward(walk)
            step1(k - 1)
            ivan.right(90)
            ivan.forward(walk)
            step2(k - 1)
            ivan.left(90)
    def step2(k):
        global stack
        stack.append(len(inspect.stack()))
        if k != 0:
            ivan.right(90)
            step1(k - 1)
            ivan.forward(walk)
            ivan.left(90)
            step2(k - 1)
            ivan.forward(walk)
            step2(k - 1)
            ivan.left(90)
            ivan.forward(walk)
            step1(k - 1)
            ivan.right(90)

    
    ivan.left(90)
    step2(iterations)

    tt.done()

if __name__ == :
    peano(4)
    import pylab as P 
    P.plot(stack)
    P.show()