Optimize 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, delete_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):


    if mo_type.startswith('EUtranFreqRelation_'):
        freq_par = ''
        baseline_type = ''
        if mo_type.endswith('_def'):
            freq_par = mo_type.split('_def')[0] + '_par'
            baseline_type = 'def'
        elif mo_type.endswith('_shym'):
            freq_par = mo_type.split('_shym')[0] + '_par_shym2'
        elif mo_type.endswith('_base'):
            freq_par = mo_type.split('_base')[0] + '_par'
        else:
            print(mo_type)
        enm_eutranfreq = EnmCli.execute_cli_command(freq_par, enm)
        eutranfreq = parse_nodeb_mo_pars(enm_eutranfreq, EnmCli.EUtranCellFDD_EUtranFreqRelation[-1], 'Sub_EUtranCellFDD')
        if baseline_type == 'def':
            eutranfreq_separated = delete_region(eutranfreq, 'Shymkent')
            eutranfreq_cleaned = clean_cell(eutranfreq_separated)
        else:
            eutranfreq_cleaned = clean_cell(eutranfreq)
        if eutranfreq_cleaned:
            return compare(eutranfreq_cleaned, getattr(Baseline, mo_type))
    elif mo_type == 'UeMeasControl_ReportConfigSearch_def':
        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 = delete_region(uemeas_search_cleaned, 'Shymkent')
        if uemeas_search_separated:
            return compare(uemeas_search_separated, Baseline.ReportConfigSearch_def)
    elif mo_type == 'UeMeasControl_ReportConfigA5_def':
        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 = delete_region(uemeas_a5_cleaned, 'Shymkent')
        if uemeas_a5_separated:
            return compare(uemeas_a5_separated, Baseline.ReportConfigA5_def)
    elif mo_type == 'UeMeasControl_ReportConfigB2Utra_def':
        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 = delete_region(uemeas_b2utra_cleaned, 'Shymkent')
        if uemeas_b2utra_separated:
            return compare(uemeas_b2utra_separated, Baseline.ReportConfigB2Utra_def)
    elif mo_type == 'UeMeasControl_ReportConfigB2Geran_def':
        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 = delete_region(uemeas_b2geran_cleaned, 'Shymkent')
        if uemeas_b2geran_separated:
            return compare(uemeas_b2geran_separated, Baseline.ReportConfigB2Geran_def)
    elif mo_type == 'UeMeasControl_ReportConfigEUtraInterFreqLb_1800_def':
        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 = delete_region(uemeas_interlb_cleaned_1800, 'Shymkent')
        if uemeas_interlb_cleaned_1800_separated:
            return compare(uemeas_interlb_cleaned_1800_separated, Baseline.ReportConfigEUtraInterFreqLb_co1800_def)
    elif mo_type == 'UeMeasControl_ReportConfigEUtraInterFreqLb_def':
        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 = delete_region(uemeas_interlb_cleaned, 'Shymkent')
        if uemeas_interlb_separated:
            return compare(uemeas_interlb_separated, Baseline.ReportConfigEUtraInterFreqLb_def)

common_baseline = [name for name, obj in vars(Baseline).items() if isinstance(obj, dict) and name.endswith('_base')]
default_baseline = [name for name, obj in vars(Baseline).items() if isinstance(obj, dict) and name.endswith('_def')]
shymkent_baseline = [name for name, obj in vars(Baseline).items() if isinstance(obj, dict) and name.endswith('_shym')]

# start_time = datetime.now()
inconslist = []
parslist = []
total_delta = []
output1 = [enm_main(baseline, 'ENM_1') for baseline in common_baseline]
output2 = [enm_main(baseline, 'ENM_2') for baseline in common_baseline]
output_non_shym_1 = [enm_main(baseline, 'ENM_1') for baseline in default_baseline]
output_non_shym_2 = [enm_main(baseline, 'ENM_2') for baseline in default_baseline]
output_shym_2 = [enm_main(baseline, 'ENM_2') for baseline in shymkent_baseline]
output = output1 + output2 + output_non_shym_1 + output_non_shym_2 + output_shym_2
# output = output2

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)```