Can t compare offset-naive and offset-aware datetimes lambda

I am trying to compare the time of an AWS EC2 instance object that is of type datetime with another datetime being represented as datetime.datetime.now. The line of code in question looks like,

if launchTime < datetime.datetime.now()-datetime.timedelta(seconds=20):

Where launchTime is of type datetime. However when I run it I get the error

can't compare offset-naive and offset-aware datetimes: TypeError

And I'm unsure of how to convert launchTime in such a way where I can successfully compare it.

Edited fixed code below -----------------------------------------

if launchTime.replace(tzinfo=None) < datetime.datetime.now()-datetime.timedelta(minutes=4):

Full code as well in case any future people find it of value. It's Python 3 to stop EC2 instances that have been running for an "x" amount of time. In this case if an instance is running for five minutes. Terminate it. The lambda itself is set up with Cloudwatch to run every 4 minutes as well.

import boto3
import time
import datetime

#for returning data about our newly created instance later on in fuction
client = boto3.client('ec2')

def lambda_handler(event, context):

response = client.describe_instances()
#for each instance currently running/terminated/stopped
for r in response['Reservations']:
    for i in r['Instances']:
        #if its running then we want to see if its been running for more then 3 hours. If it has then we stop it. 
        if i["State"]["Name"] == "running":
            launchTime = i["LaunchTime"]

            #can change minutes=4 to anything
            if launchTime.replace(tzinfo=None) < datetime.datetime.now()-datetime.timedelta(minutes=4):
                response = client.stop_instances(
                    InstanceIds=[
                        i["InstanceId"]
                    ]
                )

OS: DSM 6 (NAS Synology)
What happened: Daily Search is FALSE...when I restart MEDUSA the value of Daily Search change to TRUE but the second time it has to search change to FALSE again.
Logs:

2017-12-13 20:57:04 ERROR    DAILYSEARCHER :: [1a8dc66] Exception generated: astimezone() cannot be applied to a naive datetime
Traceback (most recent call last):
  File "/volume2/@appstore/sickbeard-custom/var/SickBeard/medusa/scheduler.py", line 90, in run
    self.action.run(self.force)
  File "/volume2/@appstore/sickbeard-custom/var/SickBeard/medusa/search/daily.py", line 89, in run
    end_time = show_air_time.astimezone(app_timezone) + timedelta(minutes=try_int(show.runtime, 60))
ValueError: astimezone() cannot be applied to a naive datetime
2017-12-13 20:47:24 ERROR    Thread-16 :: [1a8dc66] Exception generated: can't compare offset-naive and offset-aware datetimes
Traceback (most recent call last):
  File "/volume2/@appstore/sickbeard-custom/var/SickBeard/medusa/server/web/core/base.py", line 263, in async_call
    result = function(**kwargs)
  File "/volume2/@appstore/sickbeard-custom/var/SickBeard/medusa/server/web/core/base.py", line 351, in schedule
    results = ComingEpisodes.get_coming_episodes(ComingEpisodes.categories, app.COMING_EPS_SORT, False)
  File "/volume2/@appstore/sickbeard-custom/var/SickBeard/medusa/show/coming_episodes.py", line 121, in get_coming_episodes
    results.sort(ComingEpisodes.sorts[sort])
  File "/volume2/@appstore/sickbeard-custom/var/SickBeard/medusa/show/coming_episodes.py", line 40, in <lambda>
    'date': (lambda a, b: cmp(a['localtime'], b['localtime'])),
TypeError: can't compare offset-naive and offset-aware datetimes

Parameters of search:

Here you can see the FALSE value in Daily Search

Can t compare offset-naive and offset-aware datetimes lambda

We just upgraded to the most recent version of exchangelib on pip and are getting a new error.

File "/usr/local/lib/python3.6/dist-packages/exchangelib/queryset.py", line 287, in __iter__
    for val in self._format_items(items=self._query(), return_format=self.return_format):
File "/usr/local/lib/python3.6/dist-packages/exchangelib/queryset.py", line 256, in _query
    items = sorted(items, key=lambda i: _get_value_or_default(i, f), reverse=f.reverse)
TypeError: can't compare offset-naive and offset-aware datetimes

calendarList = account.calendar.view(start=startDateTime, end=endDateTime).order_by('-start')[:25]

I believe this may be related to a previous issue I raised back in September: #808

This seems to be a rare issue affecting a small percentage of calendar items for a single user (so far).

try:
    calendarList = account.calendar.view(start=startDateTime, end=endDateTime).order_by('-start')[:25]
except TypeError:
    calendarList = account.calendar.view(start=startDateTime, end=endDateTime)[:25]