<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def send_event(self, name, *args, **kwargs):
 """ Send an event to the native handler. This call is queued and batched. Parameters name : str The event name to be processed by MainActivity.processMessages. *args: args The arguments required by the event. **kwargs: kwargs Options for sending. These are: now: boolean Send the event now """

        n = len(self._bridge_queue)

        # Add to queue
        self._bridge_queue.append((name, args))

        if n == 0:
            # First event, send at next available time
            self._bridge_last_scheduled = time()
            self.deferred_call(self._bridge_send)
            return
        elif kwargs.get('now'):
            self._bridge_send(now=True)
            return

        # If it's been over 5 ms since we last scheduled, run now
        dt = time() - self._bridge_last_scheduled
        if dt > self._bridge_max_delay:
            self._bridge_send(now=True)