'Check that :param message: has all :param headers: headers.
:param message: can be an instance of an email.Message subclass or a
string with the contens of an email message.
:param headers: should be a set of (header-name, header-value) tuples.'

def assertMessageHasHeaders(self, message, headers):

    if isinstance(message, binary_type):
        message = message_from_bytes(message)
    msg_headers = set(message.items())
    self.assertTrue(headers.issubset(msg_headers), msg=(u'Message    is    missing    the    following    headers:    %s' % (headers - msg_headers)))
