'Emits a message to all objects inside this object.
Args:
text (str or tuple): Message to send. If a tuple, this should be
on the valid OOB outmessage form `(message, {kwargs})`,
where kwargs are optional data passed to the `text`
outputfunc.
exclude (list, optional): A list of objects not to send to.
from_obj (Object, optional): An object designated as the
"sender" of the message. See `DefaultObject.msg()` for
more info.
mapping (dict, optional): A mapping of formatting keys
`{"key":<object>, "key2":<object2>,...}. The keys
must match `{key}` markers in the `text` if this is a string or
in the internal `message` if `text` is a tuple. These
formatting statements will be
replaced by the return of `<object>.get_display_name(looker)`
for every looker in contents that receives the
message. This allows for every object to potentially
get its own customized string.
Kwargs:
Keyword arguments will be passed on to `obj.msg()` for all
messaged objects.
Notes:
The `mapping` argument is required if `message` contains
{}-style format syntax. The keys of `mapping` should match
named format tokens, and its values will have their
`get_display_name()` function called for  each object in
the room before substitution. If an item in the mapping does
not have `get_display_name()`, its string value will be used.
Example:
Say Char is a Character object and Npc is an NPC object:
char.location.msg_contents(
"{attacker} kicks {defender}",
mapping=dict(attacker=char, defender=npc), exclude=(char, npc))
This will result in everyone in the room seeing \'Char kicks NPC\'
where everyone may potentially see different results for Char and Npc
depending on the results of `char.get_display_name(looker)` and
`npc.get_display_name(looker)` for each particular onlooker'

def msg_contents(self, text=None, exclude=None, from_obj=None, mapping=None, **kwargs):

    is_outcmd = (text and is_iter(text))
    inmessage = (text[0] if is_outcmd else text)
    outkwargs = (text[1] if (is_outcmd and (len(text) > 1)) else {})
    contents = self.contents
    if exclude:
        exclude = make_iter(exclude)
        contents = [obj for obj in contents if (obj not in exclude)]
    for obj in contents:
        if mapping:
            substitutions = {t: (sub.get_display_name(obj) if hasattr(sub, 'get_display_name') else str(sub)) for (t, sub) in mapping.items()}
            outmessage = inmessage.format(**substitutions)
        else:
            outmessage = inmessage
        obj.msg(text=(outmessage, outkwargs), from_obj=from_obj, **kwargs)
