code: def keys_of_type_exist(self, *keys):
          
          # k[0] = key name, k[1] = exists, k2 = expected type
          keys_exist = [(key, key in self.keys(), expected_type)
                        for key, expected_type in keys]
  
          return tuple(ContextItemInfo(
              key=k[0],
              key_in_context=k[1],
              expected_type=k[2],
              is_expected_type=isinstance(self[k[0]], k[2])
              if k[1] else None,
              has_value=k[1] and not self[k[0]] is None
          ) for k in keys_exist)
docs: Check if keys exist in context and if types are as expected.
  
          Args:
              *keys: *args for keys to check in context.
                     Each arg is a tuple (str, type)
  
          Returns:
              Tuple of namedtuple ContextItemInfo, same order as *keys.
              ContextItemInfo(key,
                              key_in_context,
                              expected_type,
                              is_expected_type)
  
              Remember if there is only one key in keys, the return assignment
              needs an extra comma to remind python that it's a tuple:
              # one
              a, = context.keys_of_type_exist('a')
              # > 1
              a, b = context.keys_of_type_exist('a', 'b')