<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def makeHandler(self, dialect):
 """create and cache the handler object for this dialect"""

        if dialect not in self.dialects:
            m = "The dialect specified, '{}', wasn't whitelisted in change_hook".format(dialect)
            log.msg(m)
            log.msg(
                "Note: if dialect is 'base' then it's possible your URL is malformed and we didn't regex it properly")
            raise ValueError(m)

        if dialect not in self._dialect_handlers:
            if dialect not in self._plugins:
                m = "The dialect specified, '{}', is not registered as a buildbot.webhook plugin".format(dialect)
                log.msg(m)
                raise ValueError(m)
            options = self.dialects[dialect]
            if isinstance(options, dict) and 'custom_class' in options:
                klass = options['custom_class']
            else:
                klass = self._plugins.get(dialect)
            self._dialect_handlers[dialect] = klass(self.master, self.dialects[dialect])

        return self._dialect_handlers[dialect]