You can't according to science. We are simply not capable of multitasking. There is a great podcast on Hidden Brain: Life Interrupted.
However what does seem to work is no lyric music with a rhythm that's close to your own heart rate.
I listen to a genre of music someone hacked together thats seem to making gains: epic music. Popular artists I like are Two Steps from Hell and Audio Machine.
I code but it seems science agrees if you find non intrusive music that you don't need to interpret but simply "groove" subconsciously is your best bet.
Another genre I like; Baroque, chamber music ie Bach Handel