def METHOD_NAME(self, instance_d):
    client = None
    instance_pk = instance_d["pk"]
    instance_version = instance_d["version"]
    try:
        client, client_instance_version = self.clients[instance_pk]
    except KeyError:
        pass
    else:
        if client_instance_version < instance_version:
            client = None
    if client is None:
        try:
            instance = Instance.objects.get(pk=instance_pk)
        except Instance.DoesNotExist:
            logger.error("Instance %s not found", instance_pk)
            return
        client = Client.from_instance(instance)
        self.clients[instance_pk] = (client, instance.version)
    return client