code: def normalize_text(self, txt):
          "Check that text input is in the correct format/encoding"
          # - for TTF unicode fonts: unicode object (utf8 encoding)
          # - for built-in fonts: string instances (latin 1 encoding)
          if self.unifontsubset and isinstance(txt, str) and not PY3K:
              txt = txt.decode('utf8')
          elif not self.unifontsubset and isinstance(txt, unicode) and not PY3K:
              txt = txt.encode('latin1')
          return txf normalize_text(self, txt):
          "Check that text input is in the correct format/encoding"
          # - for TTF unicode fonts: unicode object (utf8 encoding)
          # - for built-in fonts: string instances (latin 1 encoding)
          if self.unifontsubset and isinstance(txt, str) and not PY3K:
              txt = txt.decode('utf8')
          elif not self.unifontsubset and isinstance(txt, unicode) and not PY3K:
              txt = txt.encode('latin1')
          return txt
docs: Check that text input is in the correct format/encoding