Optimize python code
```
from ENM_class import EnmCli

from parser_utils import parse_eutran_cells, parse_nodeb_pars, parse_nodeb_mo_pars, parse_fea, combine_fea, parse_cosector, clean_cell, clean_band, separate_region, parse_anr_rels
from Baseline import Baseline, compare
from file_write import stat, baseline_write
from collections import Counter
from dotenv import load_dotenv
from remove_old_files import remove_old_files
from mail import send_email
from upload_reports import upload_reports
# from datetime import datetime
load_dotenv('.env')


def enm_main(mo_type, enm):


# NON_SHYM
    elif mo_type == 'EUtranCellFDD_base':
        enm_eutrancell = EnmCli.execute_cli_command('EUtranCellFDD_par', enm)
        eutrancell = parse_eutran_cells(enm_eutrancell, EnmCli.EUtranCellFDD[-1])
        eutrancell_cleaned = clean_cell(eutrancell)
        eutrancell_separated = separate_region(eutrancell_cleaned, 'Shymkent')
        if eutrancell_separated:
            return compare(eutrancell_separated, Baseline.EUtranCellFDD_base)
    elif mo_type == 'EUtranCellFDD_EUtranFreqRelation_800_base':
        enm_eutranfreq_800 = EnmCli.execute_cli_command('EUtranFreqRelation_6200_par', enm) + \
                             EnmCli.execute_cli_command('EUtranFreqRelation_6300_par', enm) + \
                             EnmCli.execute_cli_command('EUtranFreqRelation_6400_par', enm)
        eutranfreq_800 = parse_nodeb_mo_pars(enm_eutranfreq_800, EnmCli.EUtranCellFDD_EUtranFreqRelation[-1], 'Sub_EUtranCellFDD')
        eutranfreq_800_cleaned = clean_cell(eutranfreq_800)
        eutranfreq_800_separated = separate_region(eutranfreq_800_cleaned, 'Shymkent')
        if eutranfreq_800_separated:
            return compare(eutranfreq_800_separated, Baseline.EUtranCellFDD_EUtranFreqRelation_6200_base)
    elif mo_type == 'EUtranCellFDD_EUtranFreqRelation_6250_base':
        enm_eutranfreq_6250 = EnmCli.execute_cli_command('EUtranFreqRelation_6250_par', enm)
        eutranfreq_6250 = parse_nodeb_mo_pars(enm_eutranfreq_6250, EnmCli.EUtranCellFDD_EUtranFreqRelation[-1], 'Sub_EUtranCellFDD')
        eutranfreq_6250_cleaned = clean_cell(eutranfreq_6250)
        if eutranfreq_6250_cleaned:
            return compare(eutranfreq_6250_cleaned, Baseline.EUtranCellFDD_EUtranFreqRelation_6250_base)
    elif mo_type == 'EUtranCellFDD_EUtranFreqRelation_1302_base':
        enm_eutranfreq_1800 = EnmCli.execute_cli_command('EUtranFreqRelation_1302_par', enm) + \
                              EnmCli.execute_cli_command('EUtranFreqRelation_1325_par', enm) + \
                              EnmCli.execute_cli_command('EUtranFreqRelation_1350_par', enm)
        eutranfreq_1800 = parse_nodeb_mo_pars(enm_eutranfreq_1800, EnmCli.EUtranCellFDD_EUtranFreqRelation[-1], 'Sub_EUtranCellFDD')
        eutranfreq_1800_cleaned = clean_cell(eutranfreq_1800)
        eutranfreq_1800_separated = separate_region(eutranfreq_1800_cleaned, 'Shymkent')
        if eutranfreq_1800_separated:
            return compare(eutranfreq_1800_separated, Baseline.EUtranCellFDD_EUtranFreqRelation_1302_base)
    elif mo_type == 'EUtranCellFDD_EUtranFreqRelation_tele_1652_1850_base':
        enm_eutranfreq_1800_tele = EnmCli.execute_cli_command('EUtranFreqRelation_1652_par', enm) + \
                                   EnmCli.execute_cli_command('EUtranFreqRelation_1850_par', enm)
        eutranfreq_1800_tele = parse_nodeb_mo_pars(enm_eutranfreq_1800_tele, EnmCli.EUtranCellFDD_EUtranFreqRelation[-1], 'Sub_EUtranCellFDD')
        eutranfreq_1800_tele_cleaned = clean_cell(eutranfreq_1800_tele)
        eutranfreq_1800_tele_separated = separate_region(eutranfreq_1800_tele_cleaned, 'Shymkent')
        if eutranfreq_1800_tele_separated:
            return compare(eutranfreq_1800_tele_separated, Baseline.EUtranCellFDD_EUtranFreqRelation_1652_1850_base)
    elif mo_type == 'EUtranCellFDD_EUtranFreqRelation_tele_1679_base':
        enm_eutranfreq_1800_tele = EnmCli.execute_cli_command('EUtranFreqRelation_1679_par', enm)
        eutranfreq_1800_tele = parse_nodeb_mo_pars(enm_eutranfreq_1800_tele, EnmCli.EUtranCellFDD_EUtranFreqRelation[-1], 'Sub_EUtranCellFDD')
        eutranfreq_1800_tele_cleaned = clean_cell(eutranfreq_1800_tele)
        eutranfreq_1800_tele_separated = separate_region(eutranfreq_1800_tele_cleaned, 'Shymkent')
        if eutranfreq_1800_tele_separated:
            return compare(eutranfreq_1800_tele_separated, Baseline.EUtranCellFDD_EUtranFreqRelation_1679_base)
    elif mo_type == 'EUtranCellFDD_EUtranFreqRelation_150_base':
        enm_eutranfreq_150 = EnmCli.execute_cli_command('EUtranFreqRelation_150_par', enm)
        eutranfreq_150 = parse_nodeb_mo_pars(enm_eutranfreq_150, EnmCli.EUtranCellFDD_EUtranFreqRelation[-1], 'Sub_EUtranCellFDD')
        eutranfreq_150_cleaned = clean_cell(eutranfreq_150)
        eutranfreq_150_separated = separate_region(eutranfreq_150_cleaned, 'Shymkent')
        if eutranfreq_150_separated:
            return compare(eutranfreq_150_separated, Baseline.EUtranCellFDD_EUtranFreqRelation_150_base)
    elif mo_type == 'EUtranCellFDD_EUtranFreqRelation_125_base':
        enm_eutranfreq_125 = EnmCli.execute_cli_command('EUtranFreqRelation_125_par', enm) + \
                             EnmCli.execute_cli_command('EUtranFreqRelation_124_par', enm) + \
                             EnmCli.execute_cli_command('EUtranFreqRelation_126_par', enm)
        eutranfreq_125 = parse_nodeb_mo_pars(enm_eutranfreq_125, EnmCli.EUtranCellFDD_EUtranFreqRelation[-1], 'Sub_EUtranCellFDD')
        eutranfreq_125_cleaned = clean_cell(eutranfreq_125)
        eutranfreq_125_separated = separate_region(eutranfreq_125_cleaned, 'Shymkent')
        if eutranfreq_125_separated:
            return compare(eutranfreq_125_separated, Baseline.EUtranCellFDD_EUtranFreqRelation_125_base)
    elif mo_type == 'EUtranCellFDD_EUtranFreqRelation_tele_500_base':
        enm_eutranfreq_tele_500 = EnmCli.execute_cli_command('EUtranFreqRelation_500_par', enm)
        eutranfreq_tele_500 = parse_nodeb_mo_pars(enm_eutranfreq_tele_500, EnmCli.EUtranCellFDD_EUtranFreqRelation[-1], 'Sub_EUtranCellFDD')
        eutranfreq_tele_500_cleaned = clean_cell(eutranfreq_tele_500)
        eutranfreq_tele_500_separated = separate_region(eutranfreq_tele_500_cleaned, 'Shymkent')
        if eutranfreq_tele_500_separated:
            return compare(eutranfreq_tele_500_separated, Baseline.EUtranCellFDD_EUtranFreqRelation_500_base)
    elif mo_type == 'UeMeasControl_ReportConfigSearch_base':
        enm_uemeas_search = EnmCli.execute_cli_command('ReportConfigSearch_par', enm)
        uemeas_search = parse_nodeb_mo_pars(enm_uemeas_search, EnmCli.UeMeasControl_ReportConfigSearch[-1], 'Sub_EUtranCellFDD')
        uemeas_search_cleaned = clean_cell(uemeas_search)
        uemeas_search_separated = separate_region(uemeas_search_cleaned, 'Shymkent')
        if uemeas_search_separated:
            return compare(uemeas_search_separated, Baseline.UeMeasControl_ReportConfigSearch_base)
    elif mo_type == 'UeMeasControl_ReportConfigA5_base':
        enm_uemeas_a5 = EnmCli.execute_cli_command('ReportConfigA5_par', enm)
        uemeas_a5 = parse_nodeb_mo_pars(enm_uemeas_a5, EnmCli.UeMeasControl_ReportConfigA5[-1], 'Sub_EUtranCellFDD')
        uemeas_a5_cleaned = clean_cell(uemeas_a5)
        uemeas_a5_separated = separate_region(uemeas_a5_cleaned, 'Shymkent')
        if uemeas_a5_separated:
            return compare(uemeas_a5_separated, Baseline.UeMeasControl_ReportConfigA5_base)
    elif mo_type == 'UeMeasControl_ReportConfigB2Utra_base':
        enm_uemeas_b2utra = EnmCli.execute_cli_command('ReportConfigB2Utra_par', enm)
        uemeas_b2utra = parse_nodeb_mo_pars(enm_uemeas_b2utra, EnmCli.UeMeasControl_ReportConfigB2Utra[-1], 'Sub_EUtranCellFDD')
        uemeas_b2utra_cleaned = clean_cell(uemeas_b2utra)
        uemeas_b2utra_separated = separate_region(uemeas_b2utra_cleaned, 'Shymkent')
        if uemeas_b2utra_separated:
            return compare(uemeas_b2utra_separated, Baseline.UeMeasControl_ReportConfigB2Utra_base)
    elif mo_type == 'UeMeasControl_ReportConfigB2Geran_base':
        enm_uemeas_b2geran = EnmCli.execute_cli_command('ReportConfigB2Geran_par', enm)
        uemeas_b2geran = parse_nodeb_mo_pars(enm_uemeas_b2geran, EnmCli.UeMeasControl_ReportConfigB2Geran[-1], 'Sub_EUtranCellFDD')
        uemeas_b2geran_cleaned = clean_cell(uemeas_b2geran)
        uemeas_b2geran_separated = separate_region(uemeas_b2geran_cleaned, 'Shymkent')
        if uemeas_b2geran_separated:
            return compare(uemeas_b2geran_separated, Baseline.UeMeasControl_ReportConfigB2Geran_base)
    elif mo_type == 'UeMeasControl_ReportConfigEUtraInterFreqLb_1800_base':
        enm_uemeas_interlb = EnmCli.execute_cli_command('ReportConfigEUtraInterFreqLb_par1', enm)
        uemeas_interlb = parse_nodeb_mo_pars(enm_uemeas_interlb, EnmCli.UeMeasControl_ReportConfigEUtraInterFreqLb1[-1], 'Sub_EUtranCellFDD')
        uemeas_interlb_cleaned = clean_cell(uemeas_interlb)
        uemeas_interlb_cleaned_1800 = clean_band(uemeas_interlb_cleaned, '1800')
        uemeas_interlb_cleaned_1800_separated = separate_region(uemeas_interlb_cleaned_1800, 'Shymkent')
        if uemeas_interlb_cleaned_1800_separated:
            return compare(uemeas_interlb_cleaned_1800_separated, Baseline.UeMeasControl_ReportConfigEUtraInterFreqLb_co1800_base)
    elif mo_type == 'UeMeasControl_ReportConfigEUtraInterFreqLb_base':
        enm_uemeas_interlb = EnmCli.execute_cli_command('ReportConfigEUtraInterFreqLb_par2', enm)
        uemeas_interlb = parse_nodeb_mo_pars(enm_uemeas_interlb, EnmCli.UeMeasControl_ReportConfigEUtraInterFreqLb2[-1], 'Sub_EUtranCellFDD')
        uemeas_interlb_cleaned = clean_cell(uemeas_interlb)
        uemeas_interlb_separated = separate_region(uemeas_interlb_cleaned, 'Shymkent')
        if uemeas_interlb_separated:
            return compare(uemeas_interlb_separated, Baseline.UeMeasControl_ReportConfigEUtraInterFreqLb_base)



non_shym_baseline_list = [
    'EUtranCellFDD_base',
    'EUtranCellFDD_EUtranFreqRelation_800_base',
    'EUtranCellFDD_EUtranFreqRelation_6250_base',
    'EUtranCellFDD_EUtranFreqRelation_1302_base',
    'EUtranCellFDD_EUtranFreqRelation_tele_1652_1850_base',
    'EUtranCellFDD_EUtranFreqRelation_tele_1679_base',
    'EUtranCellFDD_EUtranFreqRelation_150_base',
    'EUtranCellFDD_EUtranFreqRelation_125_base',
    'EUtranCellFDD_EUtranFreqRelation_tele_500_base',
    'UeMeasControl_ReportConfigSearch_base',
    'UeMeasControl_ReportConfigA5_base',
    'UeMeasControl_ReportConfigB2Utra_base',
    'UeMeasControl_ReportConfigB2Geran_base',
    'UeMeasControl_ReportConfigEUtraInterFreqLb_1800_base',
    'UeMeasControl_ReportConfigEUtraInterFreqLb_base',
]

# start_time = datetime.now()
inconslist = []
parslist = []
total_delta = []
output_non_shym_1 = [enm_main(baseline, 'ENM_1') for baseline in non_shym_baseline_list]
output_non_shym_2 = [enm_main(baseline, 'ENM_2') for baseline in non_shym_baseline_list]
output = output_non_shym_1 + output_non_shym_2

for part in output:
    try:
        incon = part[-1]
    except TypeError:
        continue
    try:
        par = part[1]
    except TypeError:
        continue
    try:
        delta = part[0]
    except TypeError:
        continue
    inconslist.append(incon)
    parslist.append(par)
    total_delta = total_delta + delta
total_pars = Counter()
total_incons = Counter()
for incons in inconslist:
    total_incons.update(incons)
for pars in parslist:
    total_pars.update(pars)

sorted_baseline_pars = dict(sorted(total_pars.items()))
sorted_baseline_incons = dict(sorted(total_incons.items()))
sorted_baseline_delta = sorted(total_delta, key=lambda d: (d.get('dictionary_item_added', {}).get("root['Region']"), d.get('dictionary_item_added', {}).get("root['ERBS_Name']")), )

remove_old_files()

stat(sorted_baseline_pars, sorted_baseline_incons, "Statistics/Baseline_Statistics.txt")

baseline_write(sorted_baseline_incons, sorted_baseline_delta)```