'Get a cursor to the oplog after the given timestamp, excluding
no-op entries.
If no timestamp is specified, returns a cursor to the entire oplog.'

def get_oplog_cursor(self, timestamp=None):

    query = {'op': {'$ne': 'n'}}
    if (timestamp is None):
        cursor = self.oplog.find(query, cursor_type=CursorType.TAILABLE_AWAIT)
    else:
        query['ts'] = {'$gte': timestamp}
        cursor = self.oplog.find(query, cursor_type=CursorType.TAILABLE_AWAIT, oplog_replay=True)
    return cursor
