def listType(l):
    """
    If the type of every element of the list l is the same, this function
    returns that type, else it returns None. If l is not a list, this function
    will raise a ValueError.
    """
    if not isinstance(l, list):
        raise ValueError("l is not a list.")

    if len(l) == 0:
        return None

    t = type(l[0])
    for e in l:
        if not isinstance(e, t):
            return None

    return t