<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def plot_sources(topo, mixmaps, unmixmaps, global_scale=None, fig=None):
 """Plot all scalp projections of mixing- and unmixing-maps. .. note:: Parameter `topo` is modified by the function by calling :func:`~eegtopo.topoplot.Topoplot.set_map`. Parameters topo : :class:`~eegtopo.topoplot.Topoplot` This object draws the topo plot mixmaps : array, shape = [w_pixels, h_pixels] Scalp-projected mixing matrix unmixmaps : array, shape = [w_pixels, h_pixels] Scalp-projected unmixing matrix global_scale : float, optional Set common color scale as given percentile of all map values to use as the maximum. `None` scales each plot individually (default). fig : Figure object, optional Figure to plot into. If set to `None`, a new figure is created. Returns ------- fig : Figure object The figure into which was plotted. """

    urange, mrange = None, None

    m = len(mixmaps)

    if global_scale:
        tmp = np.asarray(unmixmaps)
        tmp = tmp[np.logical_not(np.isnan(tmp))]
        umax = np.percentile(np.abs(tmp), global_scale)
        umin = -umax
        urange = [umin, umax]

        tmp = np.asarray(mixmaps)
        tmp = tmp[np.logical_not(np.isnan(tmp))]
        mmax = np.percentile(np.abs(tmp), global_scale)
        mmin = -mmax
        mrange = [mmin, mmax]

    y = np.floor(np.sqrt(m * 3 / 4))
    x = np.ceil(m / y)

    if fig is None:
        fig = new_figure()

    axes = []
    for i in range(m):
        axes.append(fig.add_subplot(2 * y, x, i + 1))
        plot_topo(axes[-1], topo, unmixmaps[i], crange=urange)
        axes[-1].set_title(str(i))

        axes.append(fig.add_subplot(2 * y, x, m + i + 1))
        plot_topo(axes[-1], topo, mixmaps[i], crange=mrange)
        axes[-1].set_title(str(i))

    for a in axes:
        a.set_yticks([])
        a.set_xticks([])
        a.set_frame_on(False)

    axes[0].set_ylabel('Unmixing weights')
    axes[1].set_ylabel('Scalp projections')

    return fig