Add collectd tests for all metric types

File /tests/collectd-squares.pkts contains captured collectd
packets containing 4 metrics, one for each type. Each series
has the same 10 measurements with 2 seconds interval. The
values of the measurements are i**2 for i in range(10).

Four test functions have been added to check that the values
of the samples are calculated appropriately for each type.
Fix issue with writing str to file in python 3
Add test for collectd COUNTER wrapping

File /tests/collectd-counter-wrap.pkts contains captured collectd
packets containing 2 sources of type COUNTER. The capture contains
10 measurements with 2 seconds interval for each counter that
increase by 1024 (thus expecting 9 values of 512 when parsed).

One counter wraps around 2^32, the other at 2^64.

The test currently fails because CollectDServer._calc_counter
drops the sample if the value is less than the last one received.

Note: This is required in types.db :
    "counters a:COUNTER:0:U, b:COUNTER:0:U\n"
Fix whitespace issue
Fix handling of collectd counter wrapping

from https://collectd.org/wiki/index.php/Data_source :

COUNTER
These data sources behave exactly like DERIVE data sources in
the “normal” case. Their behavior differs when valuenew < valueold,
i.e. when the new value is smaller than the previous value. In
this case, COUNTER data sources will assume the counter “wrapped
around” and take this into account. The formula for wrap-around
cases is:

rate = (2^width + val - pval) / (time - ptime)
width = pval < 2^32 ? 32 : 64
Add tests for min/max values in collectd samples

Test that values outside the range defined in types.db are dropped
for all basic collectd types.

These tests currently fail. Even though CollectDTypes parses and
stores the min/max values for each type, the sample's value isn't
checked against those limits.
Collectd types bounds checking

Add a check_range method to CollectDServer to check that the
values fall within the permitted range as defined in types.db.
Fix whitespace issue
Merge pull request #36 from dimrozakis/collectd_bounds

Collectd: Check value ranges according to types.db
Merge pull request #37 from dimrozakis/collectd_counter_wrap

Collectd: Handle counter wrapping