Convert the page limit & offset into int's & type check

def _cast_page(val):
        """ Convert the page limit & offset into int's & type check """

        try:
            val = int(val)
            if val < 0:
                raise ValueError
            return val
        except (TypeError, ValueError):
            raise ValueError