code: def _to_string(self, fmt, locale=None):
          
          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)
docs: 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