def get_request_ids(events, context):
    """
    Get request IDs from a set of lambda log events
    """
    ids = []
    for event in events:
        if ('extractedFields' in event):
            fields = event['extractedFields']
            if 'type' in fields and fields['type'] == 'END' and 'requestId' in fields:
                ids.append(fields['requestId'])
    # should always be at least one END event
    assert len(ids) > 0, "No END events found in message stream."
    # shouldn't be any dupes
    assert len(ids) == len(set(ids)), "Found duplicate request ids"
    return ids