<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def timer(self, delay, times, handler, arg):
 """ Register a timer that expires after some delay and repeats some number of times. At each expiry, will call the handler, passing the arg. To run a timer forever, use 0 times. Returns a timer_id that is used to cancel the timer in the future. Returns -1 if there was an error. """

        return lib.zloop_timer(self._as_parameter_, delay, times, handler, arg)