def write(name, values, tags={}, timestamp=None, database=None):
    """ Method to be called via threading module. """
    point = {
        'measurement': name,
        'tags': tags,
        'fields': values
    }
    if isinstance(timestamp, datetime):
        timestamp = timestamp.strftime('%Y-%m-%dT%H:%M:%SZ')
    if timestamp:
        point['time'] = timestamp
    try:
        get_db().write({'points': [point]},
                       {'db': database or settings.INFLUXDB_DATABASE})
    except Exception, e:
        if settings.INFLUXDB_FAIL_SILENTLY:
            pass
        else:
            raise e