code: def extend(self, expire=None):
          
          if expire is None:
              if self._expire is not None:
                  expire = self._expire
              else:
                  raise TypeError(
                      "To extend a lock 'expire' must be provided as an "
                      "argument to extend() method or at initialization time."
                  )
          error = _eval_script(self._client, EXTEND, self._name, args=(expire, self._id))
          if error == 1:
              raise NotAcquired("Lock %s is not acquired or it already expired." % self._name)
          elif error == 2:
              raise NotExpirable("Lock %s has no assigned expiration time" %
                                 self._name)
          elif error:
              raise RuntimeError("Unsupported error code %s from EXTEND script" % error)
docs: Extends expiration time of the lock.
  
          :param expire:
              New expiration time. If ``None`` - `expire` provided during
              lock initialization will be taken.