'Adds a :class:`.Statement` and optional sequence of parameters
to be used with the statement to the batch.
Like with other statements, parameters must be a sequence, even
if there is only one item.'

def add(self, statement, parameters=None):

    if isinstance(statement, six.string_types):
        if parameters:
            encoder = (Encoder() if (self._session is None) else self._session.encoder)
            statement = bind_params(statement, parameters, encoder)
        self._add_statement_and_params(False, statement, ())
    elif isinstance(statement, PreparedStatement):
        query_id = statement.query_id
        bound_statement = statement.bind((() if (parameters is None) else parameters))
        self._update_state(bound_statement)
        self._add_statement_and_params(True, query_id, bound_statement.values)
    elif isinstance(statement, BoundStatement):
        if parameters:
            raise ValueError('Parameters    cannot    be    passed    with    a    BoundStatement    to    BatchStatement.add()')
        self._update_state(statement)
        self._add_statement_and_params(True, statement.prepared_statement.query_id, statement.values)
    else:
        query_string = statement.query_string
        if parameters:
            encoder = (Encoder() if (self._session is None) else self._session.encoder)
            query_string = bind_params(query_string, parameters, encoder)
        self._update_state(statement)
        self._add_statement_and_params(False, query_string, ())
    return self
