Katy Perry almost didn't record 'Teenage Dream'.

Singer-songwriter Bonnie McKee - who penned several of the pop star's biggest hits including 'California Gurls', 'Wide Awake', 'Part of Me' and 'Last Friday Night (T.G.I.F.) - admits she found it difficult to part with the titular song on Katy's second album after writing it and almost kept it for herself.

Speaking to US radio station 92.3 Now, Bonnie said: ''I loved 'Teenage Dream'. I think that was my favourite one and that was a hard one for me to give up because I've had that teenage theme kind of throughout my music.''

However, the 29-year-old musician admits the track may not ''have been a hit'' if it weren't for Katy singing it.

However, Katy isn't the only top singer Bonnie has worked with; she's also penned songs for Britney Spears and Leona Lewis.

The songwriter also boasts a celebrity friend in 'Thrift Shop' hitmaker Macklemore, who she grew up with.

She said ''When 'Thrift Shop' blew up and I heard it on the radio I was like, 'This is so good!' Then I looked at the video and I was like, 'No way, that's Ben. That's my high school buddy!' ''