def strftime(self, dtime, format):      # pylint: disable=redefined-builtin
        """
        Locale-aware strftime, with format short-cuts.
        """
        format = self.STRFTIME_FORMATS.get(format + "_FORMAT", format)
        if six.PY2 and isinstance(format, six.text_type):
            format = format.encode("utf8")
        timestring = dtime.strftime(format)
        if six.PY2:
            timestring = timestring.decode("utf8")
        return timestring
Locale-aware strftime, with format short-cuts.