<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def waveform_image(mediafile, xy_size, outdir=None, center_color=None, outer_color=None, bg_color=None):
 """ Create waveform image from audio data. Return path to created image file. """

    try:
        import waveform
    except ImportError, exc:
        raise ImportError("%s [get it at https://github.com/superjoe30/PyWaveform]" % exc)

    outdir = outdir or os.path.dirname(mediafile)
    outfile = os.path.join(outdir, os.path.splitext(os.path.basename(mediafile))[0] + ".png")

    with transcode.to_wav(mediafile) as wavfile:
        # Draw using a gradient
        waveform.draw(wavfile, outfile, xy_size, 
            bgColor=bg_color or WAVE_BG_COLOR,
            fgGradientCenter=center_color or WAVE_CENTER_COLOR, 
            fgGradientOuter=outer_color or WAVE_OUTER_COLOR)

    return outfile