def sqlify(obj):
 if (obj is None):
  return 'NULL'
 elif (obj is True):
  return "'t'"
 elif (obj is False):
  return "'f'"
 elif isinstance(obj, numeric_types):
  return str(obj)
 elif isinstance(obj, datetime.datetime):
  return repr(obj.isoformat())
 else:
  if (PY2 and isinstance(obj, unicode)):
   obj = obj.encode('utf8')
  return repr(obj)

def sqlify ( obj ) : if ( obj is None ) : return 'NULL' elif ( obj is True ) : return "'t'" elif ( obj is False ) : return "'f'" elif isinstance ( obj , numeric_types ) : return str ( obj ) elif isinstance ( obj , datetime . datetime ) : return repr ( obj . isoformat ( ) ) else : if ( PY2 and isinstance ( obj , unicode ) ) : obj = obj . encode ( 'utf8' ) return repr ( obj )
converts obj to its proper sql version .