def add_header(self, header):
if header.personalization is not None:<EOL><INDENT>try:<EOL><INDENT>personalization =self._personalizations[header.personalization]<EOL>has_internal_personalization = True<EOL><DEDENT>except IndexError:<EOL><INDENT>personalization = Personalization()<EOL>has_internal_personalization = False<EOL><DEDENT>if isinstance(header, dict):<EOL><INDENT>(k, v) = list(header.items())[<NUM_LIT:0>]<EOL>personalization.add_header(Header(k, v))<EOL><DEDENT>else:<EOL><INDENT>personalization.add_header(header)<EOL><DEDENT>if not has_internal_personalization:<EOL><INDENT>self.add_personalization(<EOL>personalization,<EOL>index=header.personalization)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if isinstance(header, dict):<EOL><INDENT>(k, v) = list(header.items())[<NUM_LIT:0>]<EOL>self._headers = self._ensure_append(<EOL>Header(k, v), self._headers)<EOL><DEDENT>else:<EOL><INDENT>self._headers = self._ensure_append(header, self._headers)<EOL><DEDENT><DEDENT>
Add headers to the email globaly or to a specific Personalization

        :param value: A Header object or a dict of header key/values
        :type value: Header, dict