<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _to_string(self, fmt, locale=None):
 """ Format the instance to a common string format. :param fmt: The name of the string format :type fmt: string :param locale: The locale to use :type locale: str or None :rtype: str """

        if fmt not in self._FORMATS:
            raise ValueError("Format [{}] is not supported".format(fmt))

        fmt = self._FORMATS[fmt]
        if callable(fmt):
            return fmt(self)

        return self.format(fmt, locale=locale)