<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _generate_message(self):
 """Reformat `path` attributes of each `error` and create a new message. Join `path` attributes together in a more readable way, to enable easy debugging of an invalid Checkmatefile. :returns: Reformatted error paths and messages, as a multi-line string. """

        reformatted_paths = (
            ''.join(
                "[%s]" % str(x)
                # If it's not a string, don't put quotes around it. We do this,
                # for example, when the value is an int, in the case of a list
                # index.
                if isinstance(x, six.integer_types)
                # Otherwise, assume the path node is a string and put quotes
                # around the key name, as if we were drilling down into a
                # nested dict.
                else "['%s']" % str(x)
                for x in error.path
            )
            for error in self.errors
        )

        messages = (error.msg for error in self.errors)
        # combine each path with its message:
        zipped = zip(reformatted_paths, messages)
        combined_messages = (
            '%(path)s: %(messages)s' % dict(path=path, messages=message)
            for path, message in zipped
        )

        return '\n'.join(sorted(combined_messages))