Madeline and the Bad Hat

Madeline and the Bad Hat is a children's picture book by Ludwig Bemelmans featuring the popular children's character Madeline. It was first published by Viking Press in 1956.
Plot.
The story opens as the Spanish Ambassador to France moves into the house neighboring the boarding school in Paris. As a foreign dignitary he has many antiquities from all over the world. Of course, he has also brought his family. The girls watch the move in process with interest as Ms. Clavel lifts them to help them see over the wall. She points out that the Ambassador has a young son about their age.
Almost immediately, Madeline does not trust the boy (known as Pepito), judging him to be a "Bad Hat" as he wears a very remarkable black hat and makes mocking faces at the school through the window. However, Ms. Clavel does not take her seriously. Madeline is soon proven right as Pepito starts causing trouble for the girls. In the springtime, he hides in the trees with a slingshot as the girls engage in their daily morning exercises. He shoots pellets at them, causing much pain and shock. In the summer time, Pepito dresses as a ghost and jumps on the garden wall at night to scare the girls. In the fall, he brags about how he can fly kites far higher than the girls from the roof of his house. He even shows up Madeline's acrobatics on the bridge over the Seine River by riding his bike on the ramparts. In the winter his ice skating skills are far superior to the girls' and he makes a point to knock them down on the ice. Of course, whenever Ms. Clavel is present, he acts like a polite gentleman, earning her admiration much to the girls' chagrin.
One day after about a year of living next to each other Pepito climbs on the garden wall and invites the girls to visit his house and see his menagerie. He has captured many animals in the neighborhood and keeps them interned in his room. Madeline rebuffs him and tells him no one is interested in his menagerie. The girls concur and decline his invitation. Feeling dejected, Pepito changes his clothes into a Spanish Torero, assuming the girls will find that interesting. Madeline again shuts him down more forcefully, saying the girls don't view bull fighting as noble. Pepito leaves feeling lonely and shuts himself in his room.
Later Pepito pranks a departing diplomat from his house by using a watering can to pour water on him. Madeline sees this as she's watering plants at the window sill and informs Ms. Clavel, hoping she will finally take their girls' side against Pepito. Ms. Clavel believes that Pepito simply has pent up energy and needs a hobby to vent his feelings rather than pull pranks.
On a daily walk, she takes the girls to a toy store and buys a tool chest for Pepito to learn a trade. Later over dinner she hears Pepito using the tools to work on a project and assumes the matter has been settled. However, she has GRAVELY underestimated Pepito. The girls look out the window and to their horror see that Pepito has built a gullotine. They cry in despair (while Ms. Calvel looks quite ill) as Pepito's cook brings frightened chickens to be executed. Later, Pepito eats the chickens at his leisure and the girls are convinced he is pure evil.
Some time later the girls are out for a daily walk through a more woodsy section of Paris when Madeline distressingly spots Pepito across the street. However, he's not there to bother the girls. Rather he's carrying a sack and being followed by a growing pack of dogs from the neighborhood. He leads them to a nearby field with a windmill. The girls follow with morbid curiosity. Ms. Clavel asserts that Pepito is simply misunderstood and is bringing the dogs food.
However, Pepito has no good intentions. He maliciously declares a game of tag to the dogs, and then lets a CAT out of the bag (literally and figuratively), knowing it will drive the dogs crazy. He seriously miscalculated the prank as the cat jumps up on Pepito's head to escape the dogs. The dogs immediately tackle Pepito trying to get at the cat. Pepito screams for help as Ms. Clavel and Madeline race to the scene of the disaster. Ms. Clavel is able to get Pepito away from the dogs as Madeline is able to rescue the cat. The dogs calm down as the girls are far better with animals than Pepito. She shoos the dogs home as Ms. Clavel tends to the injured Pepito.
Back at the Spanish Embassy, Dr. Cohn is called to attend to Pepito. Pepito's parents and the embassy staff all cry in fear for Pepito's well-being. The Ambassadress thanks Ms. Clavel for saving Pepito while the Ambassador invites the girls to visit Pepito to cheer him up. Ms. Clavel procures them flowers as gifts and escorts them to the embassy, much to their reluctance as they feel Pepito got what he deserved.
Madeline is the first one in to visit Pepito. She enters his room on tip toe. Pepito is in rough shape after being attacked by the dogs, requiring a sling and many bandages. Madeline does not feel sympathy for him and calls him out for abusing the cat and the dogs as well as bullying the girls. Pepito apologizes and promises to change his ways. Madeline accepts his apology and says the girls will monitor him.
Sure enough, Pepito begins to change. He becomes a vegetarian and with the girls' help, releases all of his animals from his menagerie. Everywhere the girls go, they see Pepito caring for animals. It gets a little much when they visit the zoo, however. Pepito begins to release the animals from their captivity causing chaos. As Pepito goes to release the lions the girls panic, but Madeline bravely goes up to Pepito.
Madeline tells Pepito that he's no longer a Bad Hat. She tells him that he means well and the girls are proud of him now. Pepito accepts her laudation and ends his spree of releasing the animals. Later at night after the mess at the zoo has been cleaned up, the girls return home, have dinner, and brush their teeth. They wave to Pepito through the window before going to bed. As Ms. Clavel turns out the light, she remarks that she knew things would end well.
Adaptations.
Pepito is also a main character in the stories "Madeline and the Gypsies" and "Madeline in London", but in the TV series, he has three cousins named Paquito, Pablito and Panchito who are much worse than he himself was.