code: def toint(number):
      
      if isinstance(number, float):
          if number > 1:
              number = round(number, 0)
          else:
              # The following solves when image has small dimensions (like 1x54)
              # then scale factor 1 * 0.296296 and `number` will store `0`
              # that will later raise ZeroDivisionError.
              number = round(math.ceil(number), 0)
      return int(number)
docs: Helper to return rounded int for a float or just the int it self.