docstr: Set the 'string' for the name record identified by 'nameID', 'platformID',
  'platEncID' and 'langID'. If a record with that nameID doesn't exist, create it
  and append to the name table.
  
  'string' can be of type `str` (`unicode` in PY2) or `bytes`. In the latter case,
  it is assumed to be already encoded with the correct plaform-specific encoding
  identified by the (platformID, platEncID, langID) triplet. A warning is issued
  to prevent unexpected results.
docstr_tok: ["Set","the","'string","'","for","the","name","record","identified","by","'nameID","'",",","'platformID","'",",","'platEncID","'","and","'langID","'",".","If","a","record","with","that","nameID","does","n't","exist",",","create","it","and","append","to","the","name","table",".","'string","'","can","be","of","type","`","str","`","(","`","unicode","`","in","PY2",")","or","`","bytes","`",".","In","the","latter","case",",","it","is","assumed","to","be","already","encoded","with","the","correct","plaform-specific","encoding","identified","by","the","(","platformID",",","platEncID",",","langID",")","triplet",".","A","warning","is","issued","to","prevent","unexpected","results","."]
code: def setName(self, string, nameID, platformID, platEncID, langID):
      """Set the 'string' for the name record identified by 'nameID', 'platformID',
      'platEncID' and 'langID'. If a record with that nameID doesn't exist, create it
      and append to the name table.
  
      'string' can be of type `str` (`unicode` in PY2) or `bytes`. In the latter case,
      it is assumed to be already encoded with the correct plaform-specific encoding
      identified by the (platformID, platEncID, langID) triplet. A warning is issued
      to prevent unexpected results.
      """
      if not hasattr(self, "names"):
          self.names = []
      if not isinstance(string, str):
          if isinstance(string, bytes):
              log.warning(
                  "name string is bytes, ensure it's correctly encoded: %r",
                  string,
              )
          else:
              raise TypeError(
                  "expected unicode or bytes, found %s: %r"
                  % (type(string).__name__, string)
              )
      namerecord = self.getName(nameID, platformID, platEncID, langID)
      if namerecord:
          namerecord.string = string
      else:
          self.names.append(
              makeName(string, nameID, platformID, platEncID, langID)
          )
  
imports: from fontTools.misc import sstruct
  from fontTools.misc.textTools import bytechr, byteord, bytesjoin, strjoin, tobytes, tostr, safeEval
  from fontTools.misc.encodingTools import getEncoding
  from fontTools.ttLib import newTable
  from fontTools.ttLib.ttVisitor import TTVisitor
  from fontTools import ttLib
  import fontTools.ttLib.tables.otTables
  from fontTools.ttLib.tables import C_P_A_L_
  from .None import DefaultTable
  import struct
  import logging
label_desc: Use image node_id 11 for calling the table__n_a_m_e obj's underlying member method code with example usage: obj.setName(string, nameID, platformID, platEncID, langID) without return types