def METHOD_NAME(self, topic, not_after, push_cert=None):
    assert push_cert is None or (push_cert.topic == topic and push_cert.not_after == not_after)
    with self._lock:
        client = self._clients.get(topic)
        if not client or client.not_after < not_after:
            if push_cert is None:
                try:
                    push_cert = PushCertificate.objects.get(topic=topic)
                except PushCertificate.DoesNotExist:
                    logger.warning("Could not find push certificate with topic %s", topic)
                    return
            client = APNSClient.from_push_certificate(push_cert)
            self._clients[topic] = client
        return client