code: def quote_attrib(self, inStr):
          
          s1 = (isinstance(inStr, str) and inStr or
                '%s' % inStr)
          s1 = s1.replace('&', '&amp;')
          s1 = s1.replace('<', '&lt;')
          s1 = s1.replace('>', '&gt;')
          if '"' in s1:
          #    if "'" in s1:
              s1 = '%s' % s1.replace('"', "&quot;")
          #    else:
          #        s1 = "'%s'" % s1
          #else:
          #    s1 = '"%s"' % s1
          return s1
docs: Transforms characters between xml notation and python notation.