<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_existing_keys(self, events):
 """Returns the list of keys from the given event source that are already in the DB"""

        data = [e[self.key] for e in events]
        ss = ','.join(['%s' for _ in data])
        query = 'SELECT %s FROM %s WHERE %s IN (%s)' % (self.key, self.table, self.key, ss)
        cursor = self.conn.conn.cursor()
        cursor.execute(query, data)
        LOG.info("%s (data: %s)", query, data)
        existing = [r[0] for r in cursor.fetchall()]
        LOG.info("Existing IDs: %s" % existing)
        return set(existing)