'Convert rogue and mysterious data types.
Conversion notes:
- ``datetime.date`` and ``datetime.datetime`` objects are
converted into datetime strings.'

def default(self, value):

    if isinstance(value, datetime):
        return value.isoformat()
    elif isinstance(value, date):
        dt = datetime(value.year, value.month, value.day, 0, 0, 0)
        return dt.isoformat()
    elif isinstance(value, Decimal):
        return float(str(value))
    elif isinstance(value, set):
        return list(value)
    return super(ESJsonEncoder, self).default(value)
