code: def bound(x, m, M=None):
      """Either have m as scalar, so bound(x,m,M) which returns m <= x <= M *OR*
      have m as length 2 vector, bound(x,m, <IGNORED>) returns m[0] <= x <= m[1].
  
      Args:
          x: scalar
          m: The lower bound
          M: The upper bound
  
      Returns:
          x: scalar, bound between min (m) and Max (M)
      """
      if M is None:
          M = m[1]
          m = m[0]
      # bound x between min (m) and Max (M)
      return min(max(x, m), M)
  
file_path: gym/gym/envs/classic_control/acrobot.py
imports: from typing import Optional
  import numpy
  from numpy import cos, pi, sin
  from gym import core, logger, spaces
  from gym.error import DependencyNotInstalled
  from gym.envs.classic_control import utils
label_desc: Use image node_id 2 for calling a global function with example usage: bound(x, m, M) and returns: min