<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def entropy_bits( lst: Union[ List[Union[int, str, float, complex]], Tuple[Union[int, str, float, complex]] ] ) -> float: """Calculate the entropy of a wordlist or a numerical range. Keyword arguments: lst -- A wordlist as list or tuple, or a numerical range as a list: (minimum, maximum) """

        if not isinstance(lst, (tuple, list)):
            raise TypeError('lst must be a list or a tuple')

        size = len(lst)
        if (
                size == 2
                and isinstance(lst[0], (int, float))
                and isinstance(lst[1], (int, float))
        ):
            return calc_entropy_bits_nrange(lst[0], lst[1])

        return calc_entropy_bits(lst)