def _get_worker_device(job_name, cluster_spec, task_id, ps_strategy):
    """ Returns the worker device to use """
    if job_name != 'worker':
        return None
    from diplomacy_research.utils.tensorflow import tf
    return tf.train.replica_device_setter(cluster=tf.train.ClusterSpec(
        cluster_spec), worker_device='/job:%s/task:%d' % (job_name, task_id
        ), ps_strategy=ps_strategy)
