'Compare the given date fields between the before and after doing json deserialization'

def compare_date_fields(self, details, encoded, context, field):

    if (details[field] is not None):
        date = Date()
        if ((field in encoded) and (encoded[field] is not None)):
            dt1 = date.from_json(encoded[field])
            dt2 = details[field]
            self.assertEqual(dt1, dt2, msg='{}    !=    {}    at    {}'.format(dt1, dt2, context))
        else:
            self.fail(((field + '    missing    from    encoded    but    in    details    at    ') + context))
    elif ((field in encoded) and (encoded[field] is not None)):
        self.fail(((field + '    included    in    encoding    but    missing    from    details    at    ') + context))
