code: def _normalize_sequence(input, rank):
      """If input is a scalar, create a sequence of length equal to the
      rank by duplicating the input. If input is a sequence,
      check if its length is equal to the length of array.
      """
      is_str = isinstance(input, str)
      if not is_str and isinstance(input, Iterable):
          normalized = list(input)
          if len(normalized) != rank:
              err = "sequence argument must have length equal to input rank"
              raise RuntimeError(err)
      else:
          normalized = [input] * rank
      return normalized
  
file_path: scipy/scipy/ndimage/_ni_support.py
imports: from collections.abc import Iterable
  import operator
  import warnings
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: _normalize_sequence(input, rank) and returns: normalized