Risky use of dict get method
Using the `get` method from the `dict` class without default values can cause undesirable results. Default parameter values can help prevent a `KeyError` exception.
def keyerror_noncompliant():
    mydict = {1: 1, 2: 2, 3: 3}
    key = 5
    try:
        # Noncompliant: uses [] which causes exception when key is not found.
        count = mydict[key]
    except KeyError:
        count = 0
    return count
def keyerror_compliant():
    mydict = {1: 1, 2: 2, 3: 3}
    key = 5
    # Compliant: uses get() with a default value.
    return mydict.get(key, 0)