<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def linsert(self, key, pivot, value, before=False):
 """Inserts value in the list stored at key either before or after the reference value pivot. """

        where = b'AFTER' if not before else b'BEFORE'
        return self.execute(b'LINSERT', key, where, pivot, value)