human
Complete this python program:
def get_event_differences(expected, actual, tolerate=None):
assistant
#Here is the Python code you requested.

    """Given two events, gather a list of differences between them given some set of tolerated variances.
    """
    tolerate = EventMatchTolerates.default_if_not_defined(tolerate)
    if (EventMatchTolerates.STRING_PAYLOAD in tolerate):
        expected = parse_event_payload(expected)
        actual = parse_event_payload(actual)
    def should_strict_compare(path):
        '\n                                We    want    to    be    able    to    vary    the    degree    of    strictness    we    apply    depending    on    the    testing    context.\n\n                                Some    tests    will    want    to    assert    that    the    entire    event    matches    exactly,    others    will    tolerate    some    variance    in    the\n                                context    or    root    fields,    but    not    in    the    payload    (for    example).\n                                '
        if ((path == []) and (EventMatchTolerates.ROOT_EXTRA_FIELDS in tolerate)):
            return False
        elif ((path == ['event']) and (EventMatchTolerates.PAYLOAD_EXTRA_FIELDS in tolerate)):
            return False
        elif ((path == ['context']) and (EventMatchTolerates.CONTEXT_EXTRA_FIELDS in tolerate)):
            return False
        else:
            return True
    return compare_structs(expected, actual, should_strict_compare=should_strict_compare)