def sanity_check_execution_spec(execution_spec):
<EOL>def_ = dict(type="<STR_LIT>",<EOL>distributed_spec=None,<EOL>session_config=None)<EOL>if execution_spec is None:<EOL><INDENT>return def_<EOL><DEDENT>assert isinstance(execution_spec, dict), "<STR_LIT>".format(type(execution_spec).__name__)<EOL>type_ = execution_spec.get("<STR_LIT:type>")<EOL>if type_ == "<STR_LIT>":<EOL><INDENT>def_ = dict(job="<STR_LIT>", task_index=<NUM_LIT:0>, cluster_spec={<EOL>"<STR_LIT>": ["<STR_LIT>"],<EOL>"<STR_LIT>": ["<STR_LIT>"]<EOL>})<EOL>def_.update(execution_spec.get("<STR_LIT>", {}))<EOL>execution_spec["<STR_LIT>"] = def_<EOL>execution_spec["<STR_LIT>"] = execution_spec.get("<STR_LIT>")<EOL>return execution_spec<EOL><DEDENT>elif type_ == "<STR_LIT>":<EOL><INDENT>return execution_spec<EOL><DEDENT>elif type_ == "<STR_LIT>":<EOL><INDENT>return execution_spec<EOL><DEDENT>if execution_spec.get('<STR_LIT>') != None:<EOL><INDENT>assert type(execution_spec['<STR_LIT>']) is int, "<STR_LIT>".format(type(execution_spec['<STR_LIT>']).__name__)<EOL>assert execution_spec['<STR_LIT>'] > <NUM_LIT:0>, "<STR_LIT>".format(execution_spec['<STR_LIT>'])<EOL>return execution_spec<EOL><DEDENT>raise TensorForceError("<STR_LIT>".format(type_))<EOL>
Sanity checks a execution_spec dict, used to define execution logic (distributed vs single, shared memories, etc..)
and distributed learning behavior of agents/models.
Throws an error or warns if mismatches are found.

Args:
    execution_spec (Union[None,dict]): The spec-dict to check (or None). Dict needs to have the following keys:
        - type: "single", "distributed"
        - distributed_spec: The distributed_spec dict with the following fields:
            - cluster_spec: TensorFlow ClusterSpec object (required).
            - job: The tf-job name.
            - task_index: integer (required).
            - protocol: communication protocol (default: none, i.e. 'grpc').
        - session_config: dict with options for a TensorFlow ConfigProto object (default: None).

Returns: A cleaned-up (in-place) version of the given execution-spec.