def __val_convert(self, val): # maybe I should make a decorator from this.

        """
        Convert input data to a range tuple (start, end).

        Parameters
        ----------
        val : int or tuple or list or range
            Two element indexed object, that represents a range, or integer.

        Returns
        -------
        converted : tuple
            Tuple that represents a range.
        """

        converted = (0, 0) # just in case

        # validate and change val to a tuple.

        if isinstance(val, range) and 0 <= val.start < val.stop and val.step == 1:

            converted = (val.start, val.stop)

        elif (isinstance(val, tuple) or isinstance(val, list)) and 0 <= val[1] < val[0] and len(val) == 2:

            converted = val

        elif isinstance(val, int):
            converted = (val, val+1)

        else:
            raise ValueError("Expected indexed positive value of lenght 2, integer or range of step 1")

        return converted
dataset/ETHPy150Open rasguanabana/ytfs/ytfs/range_t.py/range_t.__val_convert/swapped operands of `<`