code: def literal(self, o):
          
          if isinstance(o, unicode):
              s = self.string_literal(o.encode(self.encoding))
          elif isinstance(o, bytearray):
              s = self._bytes_literal(o)
          elif isinstance(o, bytes):
              if PY2:
                  s = self.string_literal(o)
              else:
                  s = self._bytes_literal(o)
          elif isinstance(o, (tuple, list)):
              s = self._tuple_literal(o)
          else:
              s = self.escape(o, self.encoders)
              if isinstance(s, unicode):
                  s = s.encode(self.encoding)
          assert isinstance(s, bytes)
          return s
docs: If o is a single object, returns an SQL literal as a string.
          If o is a non-string sequence, the items of the sequence are
          converted and returned as a sequence.
  
          Non-standard. For internal use; do not use this in your
          applications.