Mistři v programování na #hovnokod

Python #421

if row[0].find('lk_s_du') > -1 or row[0].find('lk_s_su') > -1:
    price = ''
    if row[6] == 'incoming_external':
        if tariff['ie_price_second'] == 0:
            price = row[5] * tariff['ie_price_first'] / 102400
        elif ie_global > tariff['ie_price_switch']:
            price = row[5] * tariff['ie_price_second'] / 102400
        else:
            price = overhead(tariff['ie_price_switch']-ie_global,tariff['ie_price_switch'])*tariff['ie_price_first'] / 102400 + hev((row[5]+ie_global-tariff['ie_price_switch']))*tariff['ie_price_second'] / 102400
        ie_global += row[5]
        unit = 'kb'
        if tariff['price_per_unit'] == 1:
            price = price /1024
            unit = 'mb'
        if tariff['price_per_unit'] == 2:
            price = price /1024/1024
            unit = 'gb'
        if tariff['price_per_unit'] == 3:
            price = price /1024/1024/1024
            unit = 'tb'
    if row[6] == 'internal':
        if tariff['il_price_second'] == 0:
            price = row[5] * tariff['il_price_first'] / 102400
        elif il_global > tariff['il_price_switch']:
            price = row[5] * tariff['il_price_second'] / 102400
        else:
            price = overhead(tariff['il_price_switch']-il_global,tariff['il_price_switch'])*tariff['il_price_first'] / 102400 + hev((row[5]+il_global-tariff['il_price_switch']))*tariff['il_price_second'] / 102400
        il_global += row[5]
        unit = 'kb'
        if tariff['price_per_unit'] == 1:
            price = price /1024
            unit = 'mb'
        if tariff['price_per_unit'] == 2:
            price = price /1024/1024
            unit = 'gb'
        if tariff['price_per_unit'] == 3:
            price = price /1024/1024/1024
            unit = 'tb'
    if row[6] == 'outgoing_any':
        if tariff['oe_price_second'] == 0:
            price = row[5] * tariff['oe_price_first'] / 102400
        elif oe_global > tariff['oe_price_switch']:
            price = row[5] * tariff['oe_price_second'] / 102400
        else:
            price = overhead(tariff['oe_price_switch']-oe_global,tariff['oe_price_switch'])*tariff['oe_price_first'] / 102400 + hev((row[5]+oe_global-tariff['oe_price_switch']))*tariff['oe_price_second'] / 102400
        oe_global += row[5]
        unit = 'kb'
        if tariff['price_per_unit'] == 1:
            price = price /1024
            unit = 'mb'
        if tariff['price_per_unit'] == 2:
            price = price /1024/1024
            unit = 'gb'
        if tariff['price_per_unit'] == 3:
            price = price /1024/1024/1024
            unit = 'tb'
    price = str(price).replace('.',',')

HovnoKod,