code: def format_db_selection(selection, engine=None):
      
      # parse selection for SQL query
      if selection is None:
          return ''
      selections = []
      for col, op_, value in parse_column_filters(selection):
          if engine and engine.name == 'postgresql':
              col = '"%s"' % col
          try:
              opstr = [key for key in OPERATORS if OPERATORS[key] is op_][0]
          except KeyError:
              raise ValueError("Cannot format database 'WHERE' command with "
                               "selection operator %r" % op_)
          selections.append('{0} {1} {2!r}'.format(col, opstr, value))
      if selections:
          return 'WHERE %s' % ' AND '.join(selections)
      return ''
docs: Format a column filter selection as a SQL database WHERE string