def types_msg(instance, types):
reprs = []<EOL>for type in types:<EOL><INDENT>try:<EOL><INDENT>reprs.append(repr(type["<STR_LIT:name>"]))<EOL><DEDENT>except Exception:<EOL><INDENT>reprs.append(repr(type))<EOL><DEDENT><DEDENT>return "<STR_LIT>" % (instance, "<STR_LIT:U+002CU+0020>".join(reprs))<EOL>
Create an error message for a failure to match the given types.

If the ``instance`` is an object and contains a ``name`` property, it will
be considered to be a description of that object and used as its type.

Otherwise the message is simply the reprs of the given ``types``.