code: def validate_keys(dict_, expected, funcname):
      
      expected = set(expected)
      received = set(dict_)
  
      missing = expected - received
      if missing:
          raise ValueError(
              "Missing keys in {}:\n"
              "Expected Keys: {}\n"
              "Received Keys: {}".format(
                  funcname,
                  sorted(expected),
                  sorted(received),
              )
          )
  
      unexpected = received - expected
      if unexpected:
          raise ValueError(
              "Unexpected keys in {}:\n"
              "Expected Keys: {}\n"
              "Received Keys: {}".format(
                  funcname,
                  sorted(expected),
                  sorted(received),
              )
          )
docs: Validate that a dictionary has an expected set of keys.