code: def quote_value(value):
      
      adapted = adapt(value)
      if hasattr(adapted, 'getquoted'):
          adapted = adapted.getquoted()
      return adapted
docs: return the value ready to be used as a value in a SQL string.
  
      For example you can safely do this:
  
          cursor.execute('select * from table where key = %s' % quote_value(val))
  
      and you don't have to worry about possible SQL injections.