@staticmethod
def _flatten_mailjet_headers(headers):
    """Convert Mailjet's dict-of-strings-and/or-lists header format to our list-of-name-value-pairs

        {'name1': 'value', 'name2': ['value1', 'value2']}
          --> [('name1', 'value'), ('name2', 'value1'), ('name2', 'value2')]
        """
    result = []
    for name, values in headers.items():
        if isinstance(values, list):
            for value in values:
                result.append((name, value))
        else:
            result.append((name, values))
    return result
