def output_ec2_net(in_dates=None, in_values=None, out_dates=None,
    out_values=None, instance_id=None, output_type=None):
    """
    @type in_dates: list
    @type in_values: list
    @type out_dates: list
    @type out_values: list
    @type instance_id: unicode
    @type output_type: unicode
    """
    try:
        import matplotlib.pyplot as plt
        import matplotlib.dates as mdates
    except ImportError:
        exit('matplotlib required to output graphs.')
    if output_type in ('graph', None):
        plt.subplots_adjust(bottom=0.2)
        plt.xticks(rotation=25)
        ax = plt.gca()
        xfmt = mdates.DateFormatter('%Y-%m-%d %H:%M:%S')
        ax.xaxis.set_major_formatter(xfmt)
        in_line = plt.plot(in_dates, in_values)
        out_line = plt.plot(out_dates, out_values)
        plt.setp(in_line, color='g', linewidth=2.0, label='inbound')
        plt.setp(out_line, color='b', linewidth=2.0, label='outbound')
        plt.gcf().autofmt_xdate()
        plt.title('Network statistics for: {0}'.format(instance_id))
        plt.xlabel('Time (UTC)')
        plt.ylabel('Network (Bytes/s)')
        handles, labels = ax.get_legend_handles_labels()
        ax.legend(handles, labels)
        plt.subplots_adjust(bottom=0.2)
        plt.xticks(rotation=25)
        plt.grid()
        plt.show()
        exit(0)
