This is an old Spanish trick to keep flies out of the kitchen. Just peel an onion and cut it in half horizontally. Stud the onion with cloves and take either a big darning type needle (or piece of wire with loop on the end) and strong thread/string and stab this right through the onion and knot underneith.
Now hang this delightful bauble in the kitchen window and watch as the flies make a body swerve from coming in and bothering you.
Go on, bug off!