code: def _assert_valid_axis(ndims, axis):
      """Assert the condition `-ndims < axis <= ndims` if `axis` is not `None`."""
      if axis and (axis < -ndims or axis >= ndims):
          raise ValueError(
              "axis = %d not in [%d, %d)" % (axis, -ndims, ndims)
          )
  
file_path: neural-structured-learning/neural_structured_learning/lib/distances.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import neural_structured_learning.configs
  import tensorflow
label_desc: Use image node_id 2 for calling a global function with example usage: _assert_valid_axis(ndims, axis) without return types