docs: def _assert_is_dictlike(maybe_dictlike, valid_keys):
    """Raises a TypeError iff `maybe_dictlike` is not a dictlike object."""
    # This covers a common mistake when people use incorrect dictionary nesting
    # for initializers / partitioners etc. The previous error message was quite
    # opaque, this should be much clearer.
    if not hasattr(maybe_dictlike, "__getitem__"):
      raise TypeError(
          "Expected a dict-like object with possible keys %s, received %s" %
          (str(valid_keys), str(maybe_dictlike)))