code: def _default_if_none(value, default, name, ensure_not_none=True):
      value = value if value is not None else default
      if ensure_not_none and value is None:
          raise ValueError(
              f"{name}: expected a value to be specified in either `__init__` or `run`, found None in both"
          )
      return value
  
imports: import numpy
  import warnings
  from collections import defaultdict, deque
  from scipy import stats
  from scipy.special import softmax
  from ..core.schema import GraphSchema
  from ..core.graph import StellarGraph
  from ..core.utils import is_real_iterable
  from ..core.validation import require_integer_in_range, comma_sep
  from ..random import random_state
  from abc import ABC, abstractmethod
label_desc: Use image node_id 1 for calling a global function with example usage: _default_if_none(value, default, name, ensure_not_none) and returns: value