python check if element in list complexity