<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def counter(path, delta, create_parents=False, **kwargs):
 """ Increment or decrement a counter in a document. :param path: Path to the counter :param delta: Amount by which to modify the value. The delta can be negative but not 0. It must be an integer (not a float) as well. :param create_parents: Create the counter (and apply the modification) if it does not exist .. note:: Unlike :meth:`couchbase.bucket.Bucket.counter`, there is no `initial` argument. If the counter does not exist within the document (but its parent does, or `create_parents` is true), it will be initialized with the value of the `delta`. This operation is only valid in :cb_bmeth:`mutate_in`. .. seealso:: :func:`upsert`, :cb_bmeth:`counter` (in `Bucket`) """

    if not delta:
        raise ValueError("Delta must be positive or negative!")
    return _gen_4spec(LCB_SDCMD_COUNTER, path, delta,
                      create_path=create_parents, **kwargs)