<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def format_json(item, **kwargs):
 """ formats a datatype object to a json value """

    try:
        json.dumps(item.value)
        return item.value
    except TypeError:
        if 'time' in item.class_type.lower() \
                or 'date' in item.class_type.lower():
            return item.value.isoformat()
        raise