code: def integer_range(data, lower, upper, center=None):
      assert lower <= upper
      if lower == upper:
          # Write a value even when this is trivial so that when a bound depends
          # on other values we don't suddenly disappear when the gap shrinks to
          # zero - if that happens then often the data stream becomes misaligned
          # and we fail to shrink in cases where we really should be able to.
          data.draw_bits(1, forced=0)
          return int(lower)
  
      if center is None:
          center = lower
      center = min(max(center, lower), upper)
  
      if center == upper:
          above = False
      elif center == lower:
          above = True
      else:
          above = boolean(data)
  
      if above:
          gap = upper - center
      else:
          gap = center - lower
  
      assert gap > 0
  
      bits = bit_length(gap)
      probe = gap + 1
  
      if bits > 24 and data.draw_bits(3):
          # For large ranges, we combine the uniform random distribution from draw_bits
          # with the weighting scheme used by WideRangeIntStrategy with moderate chance.
          # Cutoff at 2 ** 24 so unicode choice is uniform but 32bit distribution is not.
          idx = Sampler([4.0, 8.0, 1.0, 1.0, 0.5]).sample(data)
          sizes = [8, 16, 32, 64, 128]
          bits = min(bits, sizes[idx])
  
      while probe > gap:
          data.start_example(INTEGER_RANGE_DRAW_LABEL)
          probe = data.draw_bits(bits)
          data.stop_example(discard=probe > gap)
  
      if above:
          result = center + probe
      else:
          result = center - probe
  
      assert lower <= result <= upper
      return int(result)
  
imports: from __future__ import absolute_import, division, print_function
  import enum
  import hashlib
  import heapq
  import sys
  from collections import OrderedDict
  from fractions import Fraction
  from hypothesis.errors import InvalidArgument
  from hypothesis.internal.compat import abc, bit_length, floor, hrange, int_from_bytes, qualname, str_to_bytes
  from hypothesis.internal.floats import int_to_float
label_desc: Use image node_id 4 for calling a global function with example usage: integer_range(data, lower, upper, center) and returns: int, int