fullTime = event.find("time").text.strip().split('\n')
        ampm = fullTime.pop()
        time = fullTime.pop()
        if ampm == "PM":
            min = time[-3:]
            time = str(int(time[:-3]) + 12) + min

        titles = event.findAll("span", {"itemprop": "name"})
        title = titles[1].text.strip()
        lTitle = title.lower()
        if lTitle.find("postponed") != -1 or lTitle.find(
                "cancelled") != -1 or lTitle.find("canceled") != -1:
            continue

        organization = titles[0].text.strip()

        urls = event.findAll("a", {"itemprop": "url"})
        eUrl = urls[1]["href"].strip()

        titleL = title.lower().split(" ")
        eCat = {cDict[key] for key in cDict.keys() & set(titleL)}
        print(eCat)

        print(date + ".," + time + ".," + title + ".," + str(list(eCat)) +
              ".," + eUrl + "\n")
        #write data in csv
        f.write(date + ".," + time + ".," + title + ".," + str(list(eCat)) +
                ".," + eUrl + "\n")

f.close()
        #     eDate = ".".join(end['date'].split("-")[::-1])

        ### URL ###
        eUrl = ""
        if 'description' in e:
            info = e['description'].strip().split(" ")
            for w in info:
                if "http" in w:
                    eUrl = w

        ### Caterogies ###
        titleL = set(title.lower().split(" "))
        eCat = set()
        # DYNAMIIC search title's words for caterogies
        for word in titleL:
            wordCat = {cDict[key] for key in cDict.keys() if word.find(key) != -1}
            for w in wordCat:
                eCat.add(w)

        # STRICT search title's words for caterogies
        eCatStrict = {sCDict[key] for key in sCDict.keys() & titleL}
        for c in eCatStrict:
            eCat.add(c)

        # order for catergory priority - kids > fitness > fun > lectures by
        eCat = list(eCat)
        if "kids" in eCat and len(eCat) > 1 and eCat.index("kids") != 0:
            kids = eCat.pop(eCat.index("kids"))
            eCat.insert(0, kids)
        elif "fitness" in eCat and len(eCat) > 1 and eCat.index("fitness") != 0:
            fitness = eCat.pop(eCat.index("fitness"))
            #     #Get today \ tmrw's dates
            #     fMD = dt.pop()
            #     if fMD == "Today":
            #         date = datetime.today().strftime('%d.%m.%Y')
            #     elif fMD == "Tomorrow":
            #         raw_date = datetime.today() + timedelta(days=1)
            #         date = raw_date.strftime('%d.%m.%Y')

            ### Caterogies ###
            titleL = set(title.lower().split(" "))
            eCat = set()
            # DYNAMIIC search title's words for caterogies
            for word in titleL:
                wordCat = {
                    cDict[key]
                    for key in cDict.keys() if word.find(key) != -1
                }
                for w in wordCat:
                    eCat.add(w)

            # STRICT search title's words for caterogies
            eCatStrict = {sCDict[key] for key in sCDict.keys() & titleL}
            for c in eCatStrict:
                eCat.add(c)

            # order for catergory priority - kids > fitness > fun > lectures by
            eCat = list(eCat)
            if "kids" in eCat and len(eCat) > 1 and eCat.index("kids") != 0:
                kids = eCat.pop(eCat.index("kids"))
                eCat.insert(0, kids)
            elif "fitness" in eCat and len(eCat) > 1 and eCat.index(
    def write_event():
        ### TITLE ###
        title = e['summary']

        ### TIME & DATE ### *if event have time defined
        start = e['start']
        if 'dateTime' in start:
            sTD = start['dateTime']
            tdSplit = sTD.split("T")
            date = tdSplit[0].split("-")
            time = tdSplit[1].split("+")[0][:-3]
        elif 'date' in start:
            date = start['date'].split("-")
        print(time)
        print(tdSplit[1])

        # ### UTC ###
        # utc = time = tdSplit[1][-6:]
        # utcPlusMinus = utc[:1]
        # utcTime = utc.split(":")
        # utcHours = float(utcTime[0][1:])
        # if utcTime[1] == "30":
        #     utcHours += .5

        ### FINAL DATE AND TIME IN UTC ###
        # 2017-11-28 23:55:59
        utcTime = time.split(":")
        hour = utcTime[0]
        minutes = utcTime[1]

        finalDT = datetime(int(date[0]), int(date[1]), int(date[2]), int(hour),
                           int(minutes))
        finalDT = str(finalDT - timedelta(hours=3))[:-3]
        print(finalDT)

        showTimeDate = finalDT.split(" ")
        utcDate = showTimeDate[0]
        utcTime = showTimeDate[1]

        # ### END TIME & DATE ### (not interesting)
        # end = e['end']
        # if 'dateTime' in end:
        #     eTD = end['dateTime']
        #     tdSplit = eTD.split("T")
        #     endDate = ".".join(tdSplit[0].split("-")[::-1])
        #     endTime = tdSplit[1].split("+")[0][:-3]
        # elif 'date' in end:
        #     eDate = ".".join(end['date'].split("-")[::-1])

        ### URL ###
        eUrl = ""
        if 'description' in e:
            info = e['description'].strip().split(" ")
            for w in info:
                if "http" in w:
                    eUrl = w

        ### Caterogies ###
        titleL = set(title.lower().split(" "))
        eCat = set()
        # DYNAMIIC search title's words for caterogies
        for word in titleL:
            wordCat = {
                cDict[key]
                for key in cDict.keys() if word.find(key) != -1
            }
            for w in wordCat:
                eCat.add(w)

        # STRICT search title's words for caterogies
        eCatStrict = {sCDict[key] for key in sCDict.keys() & titleL}
        for c in eCatStrict:
            eCat.add(c)

        # order for catergory priority - kids > fitness > fun > lectures by
        eCat = list(eCat)
        if "kids" in eCat and len(eCat) > 1 and eCat.index("kids") != 0:
            kids = eCat.pop(eCat.index("kids"))
            eCat.insert(0, kids)
        elif "fitness" in eCat and len(eCat) > 1 and eCat.index(
                "fitness") != 0:
            fitness = eCat.pop(eCat.index("fitness"))
            eCat.insert(0, fitness)
        elif "fun" in eCat and len(eCat) > 1 and eCat.index("fun") != 0:
            fun = eCat.pop(eCat.index("fun"))
            eCat.insert(0, fun)

        # stringify and "" format for database input
        eCat = str(eCat).replace("'", "''")
        print(f"eCat {eCat}")

        # write data in csv
        f.write(utcDate + ".," + utcTime + ".," + title + ".," + eCat + ".," +
                eUrl + "\n")
        print(utcDate + ".," + utcTime + ".," + title + ".," + eCat + ".," +
              eUrl)