<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def UpdateLease(self, duration):
 """Updates the lease and flushes the object. The lease is set to expire after the "duration" time from the present moment. This method is supposed to be used when operation that requires locking may run for a time that exceeds the lease time specified in OpenWithLock(). See flows/hunts locking for an example. Args: duration: Integer number of seconds. Lease expiry time will be set to "time.time() + duration". Raises: LockError: if the object is not currently locked or the lease has expired. """

    if not self.locked:
      raise LockError("Object must be locked to update the lease: %s." %
                      self.urn)

    if self.CheckLease() == 0:
      self._RaiseLockError("UpdateLease")

    self.transaction.UpdateLease(duration)