Timestamp must be string in %Y-%m-%dT%H:%M:%S. format

def is_timestamp_valid(self, timestamp):
        """Timestamp must be string in %Y-%m-%dT%H:%M:%S. format """

        try:
            timestamp_server = datetime.utcnow()
            timestamp_client = datetime.strptime(timestamp, "%Y-%m-%dT%H:%M:%S")

            d1_ts = time.mktime(timestamp_client.timetuple())
            d2_ts = time.mktime(timestamp_server.timetuple())

            diff = int(d2_ts-d1_ts) / 60

            if diff > self.timestamp_window:
                raise ImmediateHttpResponse(response=HttpBadRequest('Exceeded timestamp window'))
        except Exception, e:
            raise ImmediateHttpResponse(response=HttpBadRequest('Unknown error on timestamp validation'))

        return True