code: def _check_range(range_):
          
          try:
              if not isinstance(range_, list):
                  range_ = list(range_)
              min_, max_ = range_
          except (ValueError, TypeError):
              raise TypeError("each range in ising_linear_ranges should be a list of length 2.")
          if not isinstance(min_, Number) or not isinstance(max_, Number) or min_ > max_:
              raise ValueError(("each range in ising_linear_ranges should be a 2-tuple "
                                "(min, max) where min <= max"))
          return range_
docs: Check that a range is in the format we expect [min, max] and return