'Conditionally quote an identifier.
the \'force\' flag should be considered deprecated.'

def quote(self, ident, force=None):

    force = getattr(ident, 'quote', None)
    if (force is None):
        if (ident in self._strings):
            return self._strings[ident]
        else:
            if self._requires_quotes(ident):
                self._strings[ident] = self.quote_identifier(ident)
            else:
                self._strings[ident] = ident
            return self._strings[ident]
    elif force:
        return self.quote_identifier(ident)
    else:
        return ident
