def __format__(self, format_spec):
        """If format_spec is not empty, use it as a format string in
        format_spec.format(...) with keyword arguments named corresponding to
        fields. Otherwise just return str(self).

        :param format_spec: format specifier
        :rtype: str
        """
        if len(format_spec) > 0:
            return format_spec.format(
                num=self.num,
                name=self.name,
                symbol=self.symbol,
                variant=self.variant)
        return str(self)
def __format__ ( self , format_spec ) : if len ( format_spec ) > 0 : return format_spec . format ( num = self . num , name = self . name , symbol = self . symbol , variant = self . variant ) return str ( self )
If format_spec is not empty, use it as a format string in
        format_spec.format(...) with keyword arguments named corresponding to
        fields. Otherwise just return str(self).

        :param format_spec: format specifier
        :rtype: str