Assert that a list contains only elements of type t

    Return True if list contains elements of type t
    Raise TypeError if t is not a class
    Raise TypeError if ls is not a list
    Raise TypeError if ls contains non-t elements

    :param ls: LIST
    :param t: python class

def list_is_type(ls, t):
    '''Assert that a list contains only elements of type t

    Return True if list contains elements of type t
    Raise TypeError if t is not a class
    Raise TypeError if ls is not a list
    Raise TypeError if ls contains non-t elements

    :param ls: LIST
    :param t: python class
    '''
    if not isclass(t):
        raise TypeError("{} is not a class".format(t))
    elif not isinstance(ls, list):
        raise TypeError("{} is not a list".format(ls))
    else:
        ls_bad_types = [i for i in ls if not isinstance(i, t)]
        if len(ls_bad_types) > 0:
            raise TypeError("{} are not {}".format(ls_bad_types, t))
    return True