write flowchart for my below code.
import asyncio
import js
from pyscript import document
from pyscript import display
from pyodide.http import pyfetch
from pyodide.ffi.wrappers import add_event_listener
# import re
# import json
# from pyodide.ffi import to_js
# from datetime import datetime

global_national_code = ''


async def stp_two_login_manager(*args):
    js.console.log("Iam in the Step 2")
    token = js.document.querySelector('[name=csrfmiddlewaretoken]').value
    js.console.log(token)
    sms_code = js.document.getElementById('username').value
    js.console.log(global_national_code)
    js.console.log(sms_code)
    headers = {
        'Content-Type': 'application/x-www-form-urlencoded',
        'X-CSRFToken': token,
    }
    url = f'/login/'
    response = await pyfetch(
        url=url,
        method="POST",
        headers=headers,
        body=f"national_code={global_national_code}&code={sms_code}",
        # body=f"username=2051096244&password=52608088",
        credentials='include',
    )
    js.console.log(response.status)
    if response.status == 200:
        js.window.location.href = '/home/'
    else:
        js.console.log('Iam in the stp1 login manager and all things is bad!!!!')
        js.showAlert("خطایی رخ داده", "alert-danger")


async def stp_one_login_manager(*args):
    js.console.log("Hi im in the ")
    token = js.document.querySelector('[name=csrfmiddlewaretoken]').value
    js.console.log(token)
    national_code = js.document.getElementById('username').value
    js.console.log(national_code)
    headers = {
        'Content-Type': 'application/x-www-form-urlencoded',
        'X-CSRFToken': token,
    }
    url = f'/login/inquiry/'
    response = await pyfetch(url=url, method="POST", headers=headers, body=f"national_code={national_code}")
    response_dict = await response.json()
    js.console.log(response_dict)
    if response.status == 200:
        js.console.log('Iam in the stp1 login manager and all things is ok!!!!')
        global global_national_code
        global_national_code = national_code
        js.showAlert("موفق", "alert-success")
        # disable event of button, because with change id is not disabled.
        js.document.getElementById("stp1_button").disabled = True
        js.document.getElementById("stp1_button").hidden = True
        # showing help message.
        await asyncio.sleep(3)
        display("کد چهار رقمی را وارد کنید", target='message_div', append=False)
        # clearing the input value.
        input_form = js.document.getElementById('username')
        input_form.value = ''
        # change type of input
        input_form.type = 'number'
        input_form.max = 4
        input_form.placeholder = "کد"
        await asyncio.sleep(1)
        ########## adding new button
        btn = document.createElement("button")
        # Set the attributes of the button
        btn.type = "submit"
        btn.id = "stp2_button"
        btn.className = "form-control btn btn-primary submit px-3"
        btn.style.fontSize = "medium"
        btn.innerHTML = "ورود"
        # Get the div where you want to add the button
        div = document.getElementById("button_groups")
        # Append the button to the div
        div.appendChild(btn)
        # adding timer.
        if response_dict.get('remaining'):
            js.startCountdown(response_dict.get('remaining'))
        else:
            js.startCountdown(300)
        btn_stp2 = js.document.getElementById("stp2_button")
        add_event_listener(btn_stp2, "click", stp_two_login_manager)
    else:
        js.console.log('Iam in the stp1 login manager and all things is bad!!!!')
        js.showAlert("خطایی رخ داده", "alert-danger")


js.document.getElementById("loader").style.display = "none"
js.document.getElementById("main_div_page").style.display = "block"

btn_stp1 = js.document.getElementById("stp1_button")
add_event_listener(btn_stp1, "click", stp_one_login_manager)