def to_primitive(self, value, context=None):
        """ Schematics serializer override

        If epoch_date is true then convert the `datetime.datetime`
        object into an epoch `int`.
        """

        if context and context.get('epoch_date'):
            epoch = dt(1970, 1, 1)
            value = (value - epoch).total_seconds()
            return int(value)
        elif context and context.get('datetime_date'):
            return value
        else:
            return super(Type, self).to_primitive(value, context)
Schematics serializer override

        If epoch_date is true then convert the `datetime.datetime`
        object into an epoch `int`.