def strftime(_format,t = None):
    
    def ns(t,nb):
        # left padding with 0
        res = str(t)
        while len(res)<nb:
            res = '0'+res
        return res

    t = _check_input(t)   
    t = _check_struct_time(t)
    
    YY = ns(t[0],4)
    yy = ns(t[0],4)[2:]
    mm = ns(t[1],2)
    dd = ns(t[2],2)
    HH = t[3]
    HH24 = ns(HH,2)
    HH12 = ns(HH % 12,2)
    if HH12 == 0:HH12 = 12
    AMPM = 'AM' if 0 <= HH < 12 else 'PM'
    MM = ns(t[4],2)
    SS = ns(t[5],2)
    DoY = ns(t[7],3)
    w = t[6] + 1 if t[6] < 6 else 0
    W = ns(_get_week_of_year(t),2)
    
    abb_weekdays = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']
    full_weekdays = ['Sunday','Monday','Tuesday','Wednesday',
        'Thursday','Friday','Saturday']
    abb_months = ['Jan','Feb','Mar','Apr','May','Jun',
        'Jul','Aug','Sep','Oct','Nov','Dec']
    full_months = ['January','February','March','April','May','June',
        'July','August','September','October','November','December']

    res = _format
    res = res.replace("%H",HH24)
    res = res.replace("%I",HH12)
    res = res.replace("%p",AMPM)
    res = res.replace("%M",MM)
    res = res.replace("%S",SS)
    res = res.replace("%Y",YY)
    res = res.replace("%y",yy)
    res = res.replace("%m",mm)
    res = res.replace("%d",dd)
    res = res.replace("%a",abb_weekdays[w])
    res = res.replace("%A",full_weekdays[w])
    res = res.replace("%b",abb_months[int(mm)-1])
    res = res.replace("%B",full_months[int(mm)-1])
    res = res.replace("%j", DoY)
    res = res.replace("%w", str(w))
    res = res.replace("%W", W)
    res = res.replace("%x", mm+'/'+dd+'/'+yy)
    res = res.replace("%X", HH24+':'+MM+':'+SS)
    res = res.replace("%c", abb_weekdays[w]+' '+abb_months[int(mm)-1]+
        ' '+dd+' '+HH24+':'+MM+':'+SS+' '+YY)
    res = res.replace("%%", '%')
    
    return res
dataset/ETHPy150Open amrdraz/kodr/app/brython/www/src/Lib/time.py/strftime/original