def recursive_dict_subset(d1, d2):
  """Recursively compare two dicts.

  Assuming d1 and d2 has the same structure, with d2 having less keys than d1.
  This function compares if all key value pairs in d2 are exactly the same
  in d1.
  """
  if isinstance(d1, dict) and isinstance(d2, dict):
    for k in d2:
      if k not in d1:
        return False
      if not recursive_dict_subset(d1[k], d2[k]):
        return False
    return True
  return d1 == d2