code: def binary_to_int(binary_list, lower_bound=0, upper_bound=None):
      
      # Edge case for empty binary_list
      if binary_list == []:
          # With 0 bits, only one value can be represented,
          # and we default to lower_bound
          return lower_bound
      else:
          # The builtin int construction can take a base argument,
          # but it requires a string,
          # so we convert our binary list to a string
          integer = int(''.join([str(bit) for bit in binary_list]), 2)
  
      # Trim if over upper_bound
      if (upper_bound is not None) and integer + lower_bound > upper_bound:
          # Bounce back. Ex. w/ upper_bound = 2: [0, 1, 2, 2, 1, 0]
          return upper_bound - (integer % (upper_bound - lower_bound + 1))
      else:
          # Not over upper_bound
          return integer + lower_bound
docs: Return the base 10 integer corresponding to a binary list.
  
     The maximum value is determined by the number of bits in binary_list,
     and upper_bound. The greater allowed by the two.
  
      Args:
          binary_list: list<int>; List of 0s and 1s.
          lower_bound: Minimum value for output, inclusive.
              A binary list of 0s will have this value.
          upper_bound: Maximum value for output, inclusive.
              If greater than this bound, we "bounce back".
              Ex. w/ upper_bound = 2: [0, 1, 2, 2, 1, 0]
              Ex.
                  raw_integer = 11, upper_bound = 10, return = 10
                  raw_integer = 12, upper_bound = 10, return = 9
  
      Returns:
          int; Integer value of the binary input.