def METHOD_NAME(self, object):
    """ If the given object is an observable dict, yield that dict.
    Otherwise, raise an error unless this observer is optional.
    Parameters
    ----------
    object: object
        Object provided by another observers or by the user.
    Yields
    ------
    IObservable
    Raises
    ------
    ValueError
        If the given object is not an observable dict and optional is
        false.
    """
    if not isinstance(object, TraitDict):
        if self.optional:
            return
        raise ValueError(
            "Expected a TraitDict to be observed, "
            "got {!r} (type: {!r})".format(object, type(object))
        )
    yield object