def _slice_value(index, context=None):
if isinstance(index, Const):<EOL><INDENT>if isinstance(index.value, (int, type(None))):<EOL><INDENT>return index.value<EOL><DEDENT><DEDENT>elif index is None:<EOL><INDENT>return None<EOL><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>inferred = next(index.infer(context=context))<EOL><DEDENT>except exceptions.InferenceError:<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>if isinstance(inferred, Const):<EOL><INDENT>if isinstance(inferred.value, (int, type(None))):<EOL><INDENT>return inferred.value<EOL><DEDENT><DEDENT><DEDENT><DEDENT>return _SLICE_SENTINEL<EOL>
Get the value of the given slice index.