def clear_sent_messages(self, offset=None):
if offset is None:<EOL><INDENT>offset = getattr(settings, '<STR_LIT>', defaults.MAILQUEUE_CLEAR_OFFSET)<EOL><DEDENT>if type(offset) is int:<EOL><INDENT>offset = datetime.timedelta(hours=offset)<EOL><DEDENT>delete_before = timezone.now() - offset<EOL>self.filter(sent=True, last_attempt__lte=delete_before).delete()<EOL>
Deletes sent MailerMessage records