<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def is_valid_data(obj):
 """Check if data is JSON serializable. """

    if obj:
        try:
            tmp = json.dumps(obj, default=datetime_encoder)
            del tmp
        except (TypeError, UnicodeDecodeError):
            return False
    return True