Checking for proper html before using Beautiful Soup