<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def contains(self, val):
 """ Check if given value or range is present. Parameters val : int or tuple or list or range Range or integer being checked. Returns ------- retlen : int Length of overlapping with `val` subranges. """


        (start, end) = self.__val_convert(val) # conversion

        retlen = 0
        for r in self.__has:
            if start < r[1] and end > r[0]:
                retlen += ((end < r[1] and end) or r[1]) - ((start > r[0] and start) or r[0])

        return retlen