code: def _cast_page(val):
          
  
          try:
              val = int(val)
              if val < 0:
                  raise ValueError
              return val
          except (TypeError, ValueError):
              raise ValueError
docs: Convert the page limit & offset into int's & type check