Key error for kerning dict

When I try to run this script,
I get this error:

Traceback (most recent call last):
  File "Show Kerning Pairs.py", line 44
    for R in Font.kerning[masterID][L]:
  File "_convenience_mapping.py", line 18, in __getitem__objectForKey_
    return container_unwrap(res, KeyError, key)
  File "_convenience.py", line 113, in container_unwrap
    raise exc_type(*exc_args)

Ah I realised I needed to add .keys()