def gqn(val):
    if isinstance(val, basestring):
        if isinstance(val, unicode): val = val.encode('ascii')
        return "'%s'" % val
    else:
        return str(val)
The geographic quote name function; used for quoting tables and
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.2/django/contrib/gis/db/backends/util.py/gqn