def plot_bands(ax=None, kpath=None, bands=None, showlegend=False, E_Fermi=
    None, color1=(0, 0, 0.8), style1='solid', lw1=0.7, color2=(0.8, 0, 0),
    style2='dashed', lw2=0.7):
    """
    - Returns axes object and plot on which all matplotlib allowed actions could be performed.
    - **Parameters**
        - ax         : Matplotlib axes object, if not given, one is created.
        - kpath      : 1D array from `get_kpts().kpath` or `export_vasprun().kpath`.
        - bands      : Dictionary Object from `get_evals()` or `export_vasprun().bands`.
        - showlegend : Boolean, default is False, if true, gives legend for spin-polarized calculations.
        - E_Fermi    : If not given, automatically picked from bands object.
        - **kwargs   : lines color,width and style to distinguish spin Up and Down.
    - **Returns**
        - ax : matplotlib axes object with plotted bands.
    """
    if ax == None:
        import matplotlib.pyplot as plt
        fig, ax = plt.subplots(1, 1, figsize=(3.4, 2.6))
    else:
        ax == ax
    if kpath == None:
        raise ValueError(
            'kpath is not provided. Use get_kpath() or export_vasprun().kpath to generate it.'
            )
    if bands == None:
        raise ValueError(
            'bands object is not provided. Use get_evals() or export_vasprun().bands to generate it.'
            )
    if E_Fermi == None:
        E_Fermi = bands.E_Fermi
    if bands.ISPIN == 1:
        en = bands.evals - E_Fermi
        ax.plot(kpath, en, color=color1, lw=lw1, ls=style1)
    if bands.ISPIN == 2:
        enUp = bands.evals.SpinUp - E_Fermi
        enDown = bands.evals.SpinDown - E_Fermi
        ax.plot(kpath, enUp, color=color1, lw=lw1, ls=style1)
        ax.plot(kpath, enDown, color=color2, lw=lw2, ls=style2)
        if showlegend == True:
            ax.plot([], [], color=color1, lw=lw1, ls=style1, label='Spin Up')
            ax.plot([], [], color=color2, lw=lw2, ls=style2, label='Spin Down')
            ax.legend(fontsize='small', frameon=False, ncol=2,
                bbox_to_anchor=(0, 1), loc='lower left')
    return ax
