<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def register_handler(self, name, metadata, callback):
 """Register subscriptions and their event handlers. :param str name: the subscription name as used by watchman :param dict metadata: a dictionary of metadata to be serialized and passed to the watchman subscribe command. this should include the match expression as well as any required callback fields. :param func callback: the callback to execute on each matching filesystem event """

    assert name not in self._handlers, 'duplicate handler name: {}'.format(name)
    assert (
      isinstance(metadata, dict) and 'fields' in metadata and 'expression' in metadata
    ), 'invalid handler metadata!'
    self._handlers[name] = Watchman.EventHandler(name=name, metadata=metadata, callback=callback)