Given a datetime.datetime object, return a string representing this date/time,
        formatted according to this dateformat.

def format(self, date):
        """
        Given a datetime.datetime object, return a string representing this date/time,
        formatted according to this dateformat.
        """
        context = {'date': date}
        for handler in self.format_chain:
            handler(self, date, context)
        return eval(self.format_code, globals(), context)