def get_factory(cls, protocol: int):
        if cls._patch_tasks is None:
            cls._patch_tasks = dict()
            for patch_task_version in PatchTask.__subclasses__():
                cls._patch_tasks[patch_task_version.get_version()] = patch_task_version.create

        if protocol in cls._patch_tasks:
            return cls._patch_tasks[protocol]
        else:
            raise ProtocolException("Protocol version `%s` is not supported in this client version", protocol)